From 009c3331ca4f55757583eda0db3ea8b22a256310 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 29 Nov 2011 18:09:13 +0000 Subject: [PATCH] fix possible segfault if ID value is bigger than MN_WIDGET_ID_MAX git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1927 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2c8073dfd8f5405215820bb4e760c83f0a3e19aa Author: Jacek Jendrzej Date: 2011-11-29 (Tue, 29 Nov 2011) Origin message was: ------------------ -fix possible segfault if ID value is bigger than MN_WIDGET_ID_MAX git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1927 e54a6e83-5905-42d5-8d5c-058d10e6a962 ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 9e4d63d59..ba2c955e2 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -332,7 +332,15 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg iconfile = Icon; //handle select values - widget_index = w_index; + if(w_index > MN_WIDGET_ID_MAX){ + //error + fprintf(stderr, "Warning: %s Index ID value (%i) is bigger than MN_WIDGET_ID_MAX (%i) \n", __FUNCTION__,w_index,MN_WIDGET_ID_MAX ); + widget_index = NO_WIDGET_ID; + } + else{ + //ok + widget_index = w_index; + } preselected = NO_WIDGET_ID; selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]);