fix npe if data is null

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
Tobias Kaminsky 2019-01-30 10:10:48 +01:00 committed by tobiasKaminsky
parent 8dce69087f
commit 5ebfa13be5
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -2075,7 +2075,13 @@ public class FileDisplayActivity extends HookActivity
updateFileFromDB(); updateFileFromDB();
refreshListOfFilesFragment(false); refreshListOfFilesFragment(false);
} else if (fileDetailFragment.getView() != null) { } else if (fileDetailFragment.getView() != null) {
String errorResponse = result.getData().size() > 0 ? result.getData().get(0).toString() : ""; String errorResponse;
if (result.getData() != null && result.getData().size() > 0) {
errorResponse = result.getData().get(0).toString();
} else {
errorResponse = "";
}
if (!TextUtils.isEmpty(errorResponse)) { if (!TextUtils.isEmpty(errorResponse)) {
snackbar = Snackbar.make(fileDetailFragment.getView(), errorResponse, Snackbar.LENGTH_LONG); snackbar = Snackbar.make(fileDetailFragment.getView(), errorResponse, Snackbar.LENGTH_LONG);