Merge pull request #1462 from nextcloud/NpeInVirtuals

Fix NPE in virtuals
This commit is contained in:
Andy Scherzinger 2017-08-31 13:32:18 +02:00 committed by GitHub
commit 07bc07d4d9
2 changed files with 10 additions and 4 deletions

View file

@ -209,6 +209,8 @@ dependencies {
annotationProcessor 'org.parceler:parceler:1.1.6'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.caverock:androidsvg:1.2.1'
implementation "com.android.support:support-annotations:${supportLibraryVersion}"
/// dependencies for local unit tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
@ -217,8 +219,7 @@ dependencies {
androidTestImplementation 'com.android.support.test:rules:1.0.0'
// Android JUnit Runner
androidTestImplementation 'com.android.support.test:runner:1.0.0'
// Android Annotation Support
androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
// Espresso core
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.0'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests

View file

@ -33,6 +33,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import com.owncloud.android.MainApp;
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
@ -921,6 +922,7 @@ public class FileDataStorageManager {
return c;
}
@Nullable
private OCFile createFileInstanceFromVirtual(Cursor c) {
OCFile file = null;
if (c != null) {
@ -2148,13 +2150,16 @@ public class FileDataStorageManager {
if (c != null && c.moveToFirst()) {
do {
OCFile child = createFileInstanceFromVirtual(c);
ocFiles.add(child);
if (child != null) {
ocFiles.add(child);
}
} while (c.moveToNext());
c.close();
}
if (onlyImages) {
OCFile current = null;
OCFile current;
Vector<OCFile> temp = new Vector<>();
for (int i=0; i < ocFiles.size(); i++) {
current = ocFiles.get(i);