mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Fix crash in migration with corrupted settings.
This commit is contained in:
parent
eb1845e33b
commit
432ce4caa4
1 changed files with 12 additions and 2 deletions
|
@ -384,7 +384,7 @@ void start() {
|
||||||
|
|
||||||
EncryptedDescriptor settings;
|
EncryptedDescriptor settings;
|
||||||
if (!DecryptLocal(settings, settingsEncrypted, SettingsKey)) {
|
if (!DecryptLocal(settings, settingsEncrypted, SettingsKey)) {
|
||||||
LOG(("App Error: could not decrypt settings from settings file, maybe bad passcode..."));
|
LOG(("App Error: could not decrypt settings from settings file..."));
|
||||||
return writeSettings();
|
return writeSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,8 +422,13 @@ void start() {
|
||||||
void writeSettings() {
|
void writeSettings() {
|
||||||
if (!_settingsWriteAllowed) {
|
if (!_settingsWriteAllowed) {
|
||||||
_settingsRewriteNeeded = true;
|
_settingsRewriteNeeded = true;
|
||||||
|
|
||||||
|
// We need to generate SettingsKey anyway,
|
||||||
|
// for the moveLegacyBackground to work.
|
||||||
|
if (SettingsKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (_basePath.isEmpty()) {
|
if (_basePath.isEmpty()) {
|
||||||
LOG(("App Error: _basePath is empty in writeSettings()"));
|
LOG(("App Error: _basePath is empty in writeSettings()"));
|
||||||
return;
|
return;
|
||||||
|
@ -442,6 +447,11 @@ void writeSettings() {
|
||||||
}
|
}
|
||||||
settings.writeData(_settingsSalt);
|
settings.writeData(_settingsSalt);
|
||||||
|
|
||||||
|
if (!_settingsWriteAllowed) {
|
||||||
|
EncryptedDescriptor data(0);
|
||||||
|
settings.writeEncrypted(data, SettingsKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto configSerialized = LookupFallbackConfig().serialize();
|
const auto configSerialized = LookupFallbackConfig().serialize();
|
||||||
const auto applicationSettings = Core::App().settings().serialize();
|
const auto applicationSettings = Core::App().settings().serialize();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue