Skip to content

Commit 03d4035

Browse files
authored
Check if storage object exists before trying to read properties(#1883)
1 parent ae55fec commit 03d4035

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dwds/debug_extension_mv3/web/storage.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ Future<T?> fetchStorageObject<T>({required StorageObject type, int? tabId}) {
6262
final storageKey = _createStorageKey(type, tabId);
6363
final completer = Completer<T?>();
6464
final storageArea = _getStorageArea(type.persistance);
65-
storageArea.get([storageKey], allowInterop((Object storageObj) {
65+
storageArea.get([storageKey], allowInterop((Object? storageObj) {
66+
if (storageObj == null) {
67+
debugWarn('Does not exist.', prefix: storageKey);
68+
completer.complete(null);
69+
return;
70+
}
6671
final json = getProperty(storageObj, storageKey) as String?;
6772
if (json == null) {
6873
debugWarn('Does not exist.', prefix: storageKey);

0 commit comments

Comments
 (0)