Skip to content

Commit 4a4643f

Browse files
committed
Fixed NPE in EmailSyncService.
1 parent b8ea2cb commit 4a4643f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

FlowCrypt/src/main/java/com/flowcrypt/email/service/EmailSyncService.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,19 @@ public int onStartCommand(Intent intent, int flags, int startId) {
142142
Log.d(TAG, "onStartCommand |intent =" + intent + "|flags = " + flags + "|startId = " + startId);
143143
isServiceStarted = true;
144144

145-
switch (intent.getAction()) {
146-
case ACTION_SWITCH_ACCOUNT:
147-
emailSyncManager.setAccount(new AccountDaoSource().getActiveAccountInformation(this));
148-
emailSyncManager.beginSync(true);
149-
break;
150-
151-
default:
152-
emailSyncManager.beginSync(false);
153-
break;
145+
if (intent != null) {
146+
switch (intent.getAction()) {
147+
case ACTION_SWITCH_ACCOUNT:
148+
emailSyncManager.setAccount(new AccountDaoSource().getActiveAccountInformation(this));
149+
emailSyncManager.beginSync(true);
150+
break;
151+
152+
default:
153+
emailSyncManager.beginSync(false);
154+
break;
155+
}
154156
}
157+
155158
return super.onStartCommand(intent, flags, startId);
156159
}
157160

0 commit comments

Comments
 (0)