diff options
| author | Castor Gemini <[email protected]> | 2025-08-22 00:36:54 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-22 00:36:54 -0500 |
| commit | 279c0d0e6ca94a7a323fd2778bf090d7dff8ceb5 (patch) | |
| tree | 3dd7e5397a5debb2b599df86d7ea2c6553a9a3f6 /main.go | |
| parent | 44f860caa01cb5f491856b22dfb835836595b37a (diff) | |
fix: Add diagnostic check for nil chat entries
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -55,6 +55,17 @@ func main() { if argv.Add != "" { me.chats.AddFile(argv.Add) + + // --- Start Diagnostic Check --- + // This loop will check for nil entries in the slice before marshaling. + for i, chat := range me.chats.GetChats() { + if chat == nil { + log.Fatalf("Found a nil *Chat pointer at index %d before calling ConfigSave(). This is the cause of the panic.", i) + } + } + log.Info("Sanity check passed: No nil entries found in the Chats slice.") + // --- End Diagnostic Check --- + me.chats.ConfigSave() okExit("") } |
