mirror of
https://github.com/nextcloud/android.git
synced 2024-11-29 10:49:04 +03:00
Do not set notification manager to null in uploader service
NPE is most likely caused by a race condition, when file upload update arrives after onDestroy(). Do not set notification manager to null - it does not make any sense anyway, as it's a system service. Fixes #9390 Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
This commit is contained in:
parent
a284b6fcde
commit
0c087012d7
1 changed files with 0 additions and 5 deletions
|
@ -264,7 +264,6 @@ public class FileUploader extends Service
|
||||||
/**
|
/**
|
||||||
* Service clean up
|
* Service clean up
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.NullAssignment")
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
Log_OC.v(TAG, "Destroying service");
|
Log_OC.v(TAG, "Destroying service");
|
||||||
|
@ -275,12 +274,9 @@ public class FileUploader extends Service
|
||||||
if (mNotificationManager != null) {
|
if (mNotificationManager != null) {
|
||||||
mNotificationManager.cancel(FOREGROUND_SERVICE_ID);
|
mNotificationManager.cancel(FOREGROUND_SERVICE_ID);
|
||||||
}
|
}
|
||||||
mNotificationManager = null;
|
|
||||||
|
|
||||||
// remove AccountsUpdatedListener
|
// remove AccountsUpdatedListener
|
||||||
AccountManager am = AccountManager.get(getApplicationContext());
|
AccountManager am = AccountManager.get(getApplicationContext());
|
||||||
am.removeOnAccountsUpdatedListener(this);
|
am.removeOnAccountsUpdatedListener(this);
|
||||||
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,7 +851,6 @@ public class FileUploader extends Service
|
||||||
if (!uploadResult.isSuccess()) {
|
if (!uploadResult.isSuccess()) {
|
||||||
mNotificationManager.notify((new SecureRandom()).nextInt(), mNotificationBuilder.build());
|
mNotificationManager.notify((new SecureRandom()).nextInt(), mNotificationBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue