1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 11:45:36 +00:00

Prevent NPE

This commit is contained in:
M66B 2022-10-21 20:43:57 +02:00
parent 7081acbb2b
commit 7cf2194df5

View file

@ -3411,7 +3411,8 @@ class Core {
db.folder().setFolderSyncState(folder.id, "syncing");
String[] userFlags = ifolder.getPermanentFlags().getUserFlags();
Flags flags = ifolder.getPermanentFlags();
String[] userFlags = (flags == null ? null : flags.getUserFlags());
if (userFlags != null && userFlags.length > 0) {
List<String> keywords = new ArrayList<>(Arrays.asList(userFlags));
Collections.sort(keywords);
@ -3513,12 +3514,11 @@ class Core {
: new ReceivedDateTerm(ComparisonTerm.GE, new Date(sync_time));
SearchTerm searchTerm = dateTerm;
Flags flags = ifolder.getPermanentFlags();
if (sync_nodate && !account.isOutlook())
searchTerm = new OrTerm(searchTerm, new ReceivedDateTerm(ComparisonTerm.LT, new Date(365 * 24 * 3600 * 1000L)));
if (sync_unseen && flags.contains(Flags.Flag.SEEN))
if (sync_unseen && flags != null && flags.contains(Flags.Flag.SEEN))
searchTerm = new OrTerm(searchTerm, new FlagTerm(new Flags(Flags.Flag.SEEN), false));
if (sync_flagged && flags.contains(Flags.Flag.FLAGGED))
if (sync_flagged && flags != null && flags.contains(Flags.Flag.FLAGGED))
searchTerm = new OrTerm(searchTerm, new FlagTerm(new Flags(Flags.Flag.FLAGGED), true));
search = SystemClock.elapsedRealtime();