[apps/code] Empty controller in the var box

This commit is contained in:
Léa Saviot
2020-04-17 18:01:16 +02:00
committed by Émilie Feral
parent f98c171d2a
commit 398de8bda3
5 changed files with 60 additions and 4 deletions

View File

@@ -47,7 +47,7 @@ static bool shouldAddObject(const char * name, int maxLength) {
}
VariableBoxController::VariableBoxController(ScriptStore * scriptStore) :
NestedMenuController(nullptr, I18n::Message::FunctionsAndVariables),
AlternateEmptyNestedMenuController(I18n::Message::FunctionsAndVariables),
m_scriptStore(scriptStore),
m_currentScriptNodesCount(0),
m_builtinNodesCount(0),
@@ -141,7 +141,7 @@ void VariableBoxController::tableViewDidChangeSelection(SelectableTableView * t,
return;
}
const int currentSelectedRow = selectedRow();
if (typeAtLocation(0, currentSelectedRow) == k_subtitleCellType) {
if (currentSelectedRow >= 0 && typeAtLocation(0, currentSelectedRow) == k_subtitleCellType) {
if (currentSelectedRow == 0) {
t->selectCellAtLocation(0, 1);
} else {