diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-12-03 13:26:44 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2020-12-03 13:26:44 +0200 |
commit | 65d661bc67a1ea712a8311fa474cf222f2bd3504 (patch) | |
tree | b177295ff17c386a2c1b312dcfb8f52d20261b88 | |
parent | 9abac37e42781aaacfc9331627182c2e83f98fd9 (diff) |
SL-6109 Crash fix for left right selection shift when nothing or whole string is selected
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 208fc0a219..7d4661c6c7 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2226,22 +2226,25 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { // TODO: support multi-select LLScrollListItem *item = getFirstSelected(); - S32 cell = item->getSelectedCell(); - switch (mSelectionType) + if (item) { - case CELL: - if (cell < mColumns.size()) cell++; - break; - case HEADER: - if (cell == -1) cell = 1; - else if (cell > 1 && cell < mColumns.size()) cell++; // skip header - break; - case ROW: - cell = -1; - break; + S32 cell = item->getSelectedCell(); + switch (mSelectionType) + { + case CELL: + if (cell < mColumns.size()) cell++; + break; + case HEADER: + if (cell == -1) cell = 1; + else if (cell > 1 && cell < mColumns.size()) cell++; // skip header + break; + case ROW: + cell = -1; + break; + } + item->setSelectedCell(cell); + handled = TRUE; } - item->setSelectedCell(cell); - handled = TRUE; } break; case KEY_RIGHT: @@ -2249,22 +2252,25 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask ) { // TODO: support multi-select LLScrollListItem *item = getFirstSelected(); - S32 cell = item->getSelectedCell(); - switch (mSelectionType) + if (item) { - case CELL: - if (cell >= 0) cell--; - break; - case HEADER: - if (cell > 1) cell--; - else if (cell == 1) cell = -1; // skip header - break; - case ROW: - cell = -1; - break; + S32 cell = item->getSelectedCell(); + switch (mSelectionType) + { + case CELL: + if (cell >= 0) cell--; + break; + case HEADER: + if (cell > 1) cell--; + else if (cell == 1) cell = -1; // skip header + break; + case ROW: + cell = -1; + break; + } + item->setSelectedCell(cell); + handled = TRUE; } - item->setSelectedCell(cell); - handled = TRUE; } break; case KEY_PAGE_UP: |