This commit is contained in:
Junyuan Feng
2022-02-08 15:40:26 +08:00
parent 1bd43829bb
commit 5bf5a4b67e
9 changed files with 173 additions and 159 deletions

View File

@@ -23,7 +23,11 @@ class ServerStore extends PersistentStore {
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
final ss = fetch();
ss[index(old)] = newInfo;
final idx = index(old);
if (idx < 0) {
throw RangeError.index(idx, ss);
}
ss[idx] = newInfo;
box.put('servers', json.encode(ss));
}