diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-31 17:27:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-31 17:28:05 +0000 |
commit | 8b774b7eb1bb78245214775113830418624bbecf (patch) | |
tree | 76cf1d33c7f2332ce8a3478327a3a3122da8fca5 /svtools | |
parent | cba921ea0b293acc4b4e64f043f2e56d3e4cb15b (diff) |
fix crash traversing tools->options with keyboard
Change-Id: Ieba85dd0093c9f704090075d2eb75f1eefdd72de
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 2ec20bd0dea9..ea451b6178d9 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -1751,9 +1751,14 @@ void SvTreeList::ResortChildren( SvTreeListEntry* pParent ) SvTreeListEntry* p = *it; sal_uLong nListPos = ULONG_MAX; GetInsertionPos(p, pParent, nListPos); - SvTreeListEntries::iterator itPos = pParent->maChildren.begin(); - std::advance(itPos, nListPos); - pParent->maChildren.insert(itPos, p); + if (nListPos < pParent->maChildren.size()) + { + SvTreeListEntries::iterator itPos = pParent->maChildren.begin(); + std::advance(itPos, nListPos); + pParent->maChildren.insert(itPos, p); + } + else + pParent->maChildren.push_back(p); if (!p->maChildren.empty()) // Recursively sort child entries. ResortChildren(p); |