mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
prevent null-pointer in case remote file listing UI gets closed before the async loading comes back
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
7db5c5ed76
commit
766d07d3fa
1 changed files with 19 additions and 7 deletions
|
@ -2,6 +2,8 @@
|
|||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -20,20 +22,26 @@
|
|||
|
||||
package com.nextcloud.talk.components.filebrowser.operations;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.nextcloud.talk.components.filebrowser.interfaces.ListingInterface;
|
||||
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
|
||||
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class DavListing extends ListingAbstractClass {
|
||||
private static final String TAG = DavListing.class.getSimpleName();
|
||||
|
||||
private DavResponse davResponse = new DavResponse();
|
||||
|
||||
public DavListing(ListingInterface listingInterface) {
|
||||
|
@ -50,18 +58,22 @@ public class DavListing extends ListingAbstractClass {
|
|||
}).subscribeOn(Schedulers.io())
|
||||
.subscribe(new SingleObserver<ReadFilesystemOperation>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ReadFilesystemOperation readFilesystemOperation) {
|
||||
public void onSuccess(@NonNull ReadFilesystemOperation readFilesystemOperation) {
|
||||
davResponse = readFilesystemOperation.readRemotePath();
|
||||
listingInterface.listingResult(davResponse);
|
||||
try {
|
||||
listingInterface.listingResult(davResponse);
|
||||
} catch (NullPointerException npe) {
|
||||
Log.i(TAG, "Error loading remote folder - due to view already been terminated", npe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
public void onError(@NonNull Throwable e) {
|
||||
listingInterface.listingResult(davResponse);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue