diff --git a/lib/services/path_history_service.dart b/lib/services/path_history_service.dart index e2bca41..d395c33 100644 --- a/lib/services/path_history_service.dart +++ b/lib/services/path_history_service.dart @@ -69,12 +69,17 @@ class PathHistoryService { } try { - final decoded = jsonDecode(raw); - if (decoded is Map) { - for (final entry in decoded.entries) { - final value = entry.value; - if (value is Map) { - _cache[entry.key] = ContactPathHistory.fromJson(entry.key, value); + if (raw != null && raw.isNotEmpty) { + final decoded = jsonDecode(raw); + if (decoded is Map) { + for (final entry in decoded.entries) { + final value = entry.value; + if (value is Map) { + _cache[entry.key] = ContactPathHistory.fromJson( + entry.key, + value, + ); + } } } }