Fix crash when dragging card list past end.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1431 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2009-11-25 06:30:07 +00:00
parent 20c231e31d
commit b561e22476
+1
View File
@@ -103,6 +103,7 @@ void CardListBase::onAction(const Action& action, bool undone) {
}
TYPE_CASE(action, ReorderCardsAction) {
if (sort_by_column >= 0) return; // nothing changes for us
if ((long)action.card_id1 < 0 || (long)action.card_id2 >= sorted_list.size()) return;
if ((long)action.card_id1 == selected_item_pos || (long)action.card_id2 == selected_item_pos) {
// Selected card has moved; also move in the sorted card list
swap(sorted_list[action.card_id1], sorted_list[action.card_id2]);