aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-02-22 12:54:06 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2021-02-22 12:54:06 -0600
commitd32ad43665e9218258ff57ed98b8ed457e313ee5 (patch)
treef996f9b2dd260385b50db5f36349079ac706dfb3
parent679dcca0792650f3a2899af8009846fdc289c9ba (diff)
Fix crash caused by pre-2.6 IC packet
-rw-r--r--src/courtroom.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index b7d8a074..cc97a405 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1941,7 +1941,13 @@ void Courtroom::chatmessage_enqueue(QStringList p_contents)
// Record the log I/O, log files should be accurate.
// If desynced logs are on, display the log IC immediately.
LogMode log_mode = ao_app->is_desyncrhonized_logs_enabled() ? DISPLAY_AND_IO : IO_ONLY;
- log_chatmessage(p_contents[MESSAGE], f_char_id, p_contents[SHOWNAME], p_contents[TEXT_COLOR].toInt(), log_mode);
+
+ // Use null showname if packet does not support 2.6+ extensions
+ QString showname = QString();
+ if (SHOWNAME < p_contents.size())
+ showname = p_contents[SHOWNAME];
+
+ log_chatmessage(p_contents[MESSAGE], f_char_id, showname, p_contents[TEXT_COLOR].toInt(), log_mode);
// Send this boi into the queue
chatmessage_queue.enqueue(p_contents);