Commit 3404797
authored
fix: map manager crashes on empty maps directory (#280)
* fix: return empty array from ScanMaps when maps dir is missing
When the maps directory doesn't exist, ScanMaps returned nil which
Go serializes as JSON `null`. The frontend crashed trying to spread
null into an array, and the silent catch block redirected to `/`
with no console output — making the map manager appear broken.
Return `[]MapInfo{}` (JSON `[]`) instead, and log errors before
redirecting.
* fix: ensure ScanMaps never returns nil slice
Initialize maps as []MapInfo{} so an existing-but-empty directory
also serializes as JSON [] instead of null. Update test to match.
* fix: update handler test to expect [] instead of null1 parent f4fe70e commit 3404797
File tree
4 files changed
+7
-6
lines changed- internal
- maptool
- server
- ui/src/pages/map-manager
4 files changed
+7
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
0 commit comments