1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Desktop, Mobile: Fixes #5391: Fixed crash when a required master key does not exist

This commit is contained in:
Laurent Cozic
2021-08-28 15:36:05 +01:00
parent ad51090cdb
commit dec0a08954
2 changed files with 11 additions and 1 deletions

View File

@ -98,6 +98,14 @@ export function showMissingMasterKeyMessage(syncInfo: SyncInfo, notLoadedMasterK
for (let i = notLoadedMasterKeys.length - 1; i >= 0; i--) {
const mk = syncInfo.masterKeys.find(mk => mk.id === notLoadedMasterKeys[i]);
// A "notLoadedMasterKey" is a key that either doesn't exist or for
// which a password hasn't been set yet. For the purpose of this
// function, we only want to notify the user about unset passwords.
// Master keys that haven't been downloaded yet should normally be
// downloaded at some point.
// https://github.com/laurent22/joplin/issues/5391
if (!mk) continue;
if (!masterKeyEnabled(mk)) notLoadedMasterKeys.pop();
}