mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 08:21:47 +00:00
Handle the case where settings2 is missing, can't migrate from 3 -> 4
This commit is contained in:
parent
f340f24dc1
commit
886d4d5281
@ -289,7 +289,18 @@ impl Storage {
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ErrorKind::General("Settings missing.".to_string()).into())
|
||||
if Self::MAX_MIGRATION_LEVEL <= 4 {
|
||||
// At migraiton level < 4 we know this is safe to do:
|
||||
let settings = crate::settings::Settings::default();
|
||||
settings.save()?;
|
||||
crate::globals::GLOBALS.status_queue.write().write(
|
||||
"Settings missing or corrupted. We had to reset to defaults. Sorry about that."
|
||||
.to_owned(),
|
||||
);
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ErrorKind::General("Settings missing.".to_string()).into())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user