aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2021-01-18 21:01:57 -0600
committerGitHub <noreply@github.com>2021-01-18 21:01:57 -0600
commita929c950a017921042a0d91637be0f5478618742 (patch)
tree22ec0bbfd0c38d480836b9ae6dcb9d2cf1eaa39b
parentd41ec17fe72dbcf1b5277ab7b33b6374a9fb9e60 (diff)
parentfa969dee4fc447730ba95ed563f9b69f4931bbe5 (diff)
Merge pull request #415 from AttorneyOnline/fix/char_list
Fix a very strange OOB error
-rw-r--r--src/charselect.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/charselect.cpp b/src/charselect.cpp
index 5495b071..0a58bdaf 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -18,6 +18,7 @@ void Courtroom::construct_char_select()
ui_char_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui_char_list->hideColumn(1);
ui_char_list->setDropIndicatorShown(true);
+ set_size_and_pos(ui_char_list, "char_list");
ui_char_buttons = new QWidget(ui_char_select_background);
@@ -54,7 +55,6 @@ void Courtroom::construct_char_select()
ui_char_passworded->setChecked(true);
set_size_and_pos(ui_char_buttons, "char_buttons");
- set_size_and_pos(ui_char_list, "char_list");
connect(ui_char_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
this, SLOT(on_char_list_double_clicked(QTreeWidgetItem *, int)));
@@ -252,7 +252,7 @@ void Courtroom::character_loading_finished()
treeItem->setText(0, char_list.at(n).name);
treeItem->setIcon(0, QIcon(ao_app->get_static_image_suffix(
ao_app->get_character_path(char_list.at(n).name, "char_icon"))));
- treeItem->setData(1, Qt::DisplayRole, n);
+ treeItem->setText(1, QString::number(n));
// category logic
QTreeWidgetItem *category;
if (char_category == "") // no category
@@ -264,7 +264,7 @@ void Courtroom::character_loading_finished()
else { // we need to make a new category
category = new QTreeWidgetItem();
category->setText(0, char_category);
- category->setData(1, Qt::DisplayRole, -1);
+ category->setText(1, "-1");
category->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
ui_char_list->insertTopLevelItem(0, category);
category->addChild(treeItem);
@@ -302,7 +302,13 @@ void Courtroom::filter_character_list()
ui_char_button_list_filtered.clear();
for (int i = 0; i < char_list.size(); i++) {
AOCharButton *current_char = ui_char_button_list.at(i);
- QTreeWidgetItem *current_char_list_item = ui_char_list->findItems(QString::number(i), Qt::MatchFixedString, 1)[0];
+ QList<QTreeWidgetItem*> current_char_list_item_list = ui_char_list->findItems(QString::number(i), Qt::MatchFixedString, 1);
+ QTreeWidgetItem* current_char_list_item;
+ if (current_char_list_item_list.isEmpty()) //wtf?
+ continue;
+ else
+ current_char_list_item = current_char_list_item_list[0];
+
// It seems passwording characters is unimplemented yet?
// Until then, this will stay here, I suppose.