diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -54,19 +54,19 @@ 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) - } + newChats, err := addFile(argv.Add) + if err != nil { + badExit(err) + } + for _, newChat := range newChats.GetChats() { + me.chats.AppendByUuid(newChat) } - log.Info("Sanity check passed: No nil entries found in the Chats slice.") - // --- End Diagnostic Check --- - me.chats.ConfigSave() + // The verifyUuids function should be run on the main chats object + // after adding the new chats. + if verifyUuids(me.chats) { + me.chats.ConfigSave() + } okExit("") } |
