From 61e6b0d03c77efc22136df3a302f8a650cdc22ac Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 26 Apr 2017 15:03:30 +0200 Subject: [PATCH] improved ScriptErrorTable handling of script errors that don't have line/column associated with them (also avoiding a segfault) --- apps/opencs/view/world/scripterrortable.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/world/scripterrortable.cpp b/apps/opencs/view/world/scripterrortable.cpp index c22bcf199..ca7cbd159 100644 --- a/apps/opencs/view/world/scripterrortable.cpp +++ b/apps/opencs/view/world/scripterrortable.cpp @@ -52,6 +52,13 @@ void CSVWorld::ScriptErrorTable::addMessage (const std::string& message, columnItem->setFlags (columnItem->flags() ^ Qt::ItemIsEditable); setItem (row, 3, columnItem); } + else + { + QTableWidgetItem *lineItem = new QTableWidgetItem; + lineItem->setData (Qt::DisplayRole, "-"); + lineItem->setFlags (lineItem->flags() ^ Qt::ItemIsEditable); + setItem (row, 1, lineItem); + } QTableWidgetItem *messageItem = new QTableWidgetItem (QString::fromUtf8 (message.c_str())); messageItem->setFlags (messageItem->flags() ^ Qt::ItemIsEditable); @@ -141,7 +148,7 @@ void CSVWorld::ScriptErrorTable::settingChanged (const CSMPrefs::Setting *settin void CSVWorld::ScriptErrorTable::cellClicked (int row, int column) { - if (item (row, 1)) + if (item (row, 3)) { int scriptLine = item (row, 1)->data (Qt::DisplayRole).toInt(); int scriptColumn = item (row, 3)->data (Qt::DisplayRole).toInt();