From 7fed1697310b0f35c4d2d11829885f2a5740cb4e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 27 Oct 2016 17:06:12 +0200 Subject: [PATCH] src/gui/widget/menue.cpp fix segfault if items is empty Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/83976f40b41dc55af9b0670d5c02f067c5177077 Author: Jacek Jendrzej Date: 2016-10-27 (Thu, 27 Oct 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 3253c53d7..c80a8ebb4 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -891,9 +891,11 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) pos -= dir * items.size(); wrap = true; } - if (pos >= (int)items.size()) + if (!items.empty() && pos >= (int)items.size()) pos = (int)items.size() - 1; do { + if(items.empty()) + break; CMenuItem* item = items[pos]; if (item->isSelectable()) { if (pos < page_start[current_page + 1] && pos >= page_start[current_page]) {