瀏覽代碼

Fix rewards bug

nordsoft 3 年之前
父節點
當前提交
cd28a0791b
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      mapeditor/inspector/rewardswidget.cpp

+ 6 - 2
mapeditor/inspector/rewardswidget.cpp

@@ -346,8 +346,12 @@ void RewardsWidget::on_buttonAdd_clicked()
 
 void RewardsWidget::on_buttonRemove_clicked()
 {
-	ui->rewardsTable->removeRow(ui->rewardsTable->currentRow());
-	--rewards;
+	auto currentRow = ui->rewardsTable->currentRow();
+	if(currentRow != -1)
+	{
+		ui->rewardsTable->removeRow(currentRow);
+		--rewards;
+	}
 }