Skip to content

Commit

Permalink
Fix crash on "navigate selections"
Browse files Browse the repository at this point in the history
when navigation list is empty.

Fixes FS#454
  • Loading branch information
tea committed Dec 3, 2010
1 parent 94395e1 commit fd04262
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/styler_selections.cpp
Expand Up @@ -38,12 +38,16 @@ void Styler_Selections::EnableNavigation() {
if(m_enabled) {
m_nextSelection = -1;
m_selections = m_editorCtrl.GetSelections();
NextSelection();
if (m_selections.empty()) {
m_enabled = false;
} else {
NextSelection();
}
}
}

void Styler_Selections::NextSelection() {
if(!m_enabled) return;
if(!m_enabled || m_selections.empty()) return;

m_nextSelection++;
if((unsigned int)m_nextSelection >= m_selections.size()) {
Expand All @@ -57,7 +61,7 @@ void Styler_Selections::NextSelection() {
}

void Styler_Selections::PreviousSelection() {
if(!m_enabled) return;
if(!m_enabled || m_selections.empty()) return;

m_nextSelection--;
if(m_nextSelection < 0) {
Expand Down

0 comments on commit fd04262

Please sign in to comment.