chore: Handled decoding errors.

This commit is contained in:
2026-06-24 11:40:24 -04:00
parent a11925e720
commit 9256d94f70
2 changed files with 9 additions and 5 deletions

10
db.odin
View File

@@ -219,7 +219,10 @@ db_list :: proc(db: ^Db) -> ([]EnvFile, bool) {
remotes_json := string(sqlite.column_text(stmt, 1))
remotes: [dynamic]string = ---
if len(remotes_json) > 0 {
json.unmarshal_string(remotes_json, &remotes, allocator = allocator)
err := json.unmarshal_string(remotes_json, &remotes, allocator = allocator)
if err != nil {
fmt.eprintf("Warning: malformed remotes JSON: %v\n", err)
}
}
path := clone_cstring(sqlite.column_text(stmt, 0), allocator)
@@ -333,7 +336,10 @@ db_fetch :: proc(db: ^Db, path: string) -> (EnvFile, bool) {
remotes_json := string(sqlite.column_text(stmt, 1))
remotes: [dynamic]string = ---
if len(remotes_json) > 0 {
json.unmarshal_string(remotes_json, &remotes, allocator = allocator)
err := json.unmarshal_string(remotes_json, &remotes, allocator = allocator)
if err != nil {
fmt.eprintf("Warning: malformed remotes JSON: %v\n", err)
}
}
file_path := clone_cstring(sqlite.column_text(stmt, 0), allocator)