# HG changeset patch # User John Donoghue # Date 1428007895 14400 # Node ID 5bd3216748fc09a40fcd8ffc86dc000792d95a93 # Parent e70df1ff58b7271769e721e41424559f55062dc0 PopupMenuControl: check value is integer (Bug #44678) * libgui/graphics/PopupMenuControl.cc: (PopupMenuControl::update): check value is integer and warn if not diff -r e70df1ff58b7 -r 5bd3216748fc libgui/graphics/PopupMenuControl.cc --- a/libgui/graphics/PopupMenuControl.cc Thu Apr 02 14:50:17 2015 -0400 +++ b/libgui/graphics/PopupMenuControl.cc Thu Apr 02 16:51:35 2015 -0400 @@ -105,15 +105,22 @@ if (value.numel () > 0) { - int newIndex = int (value(0)) - 1; - - if (newIndex >= 0 && newIndex < box->count ()) + if (value(0) != static_cast(value(0))) { - if (newIndex != box->currentIndex ()) - box->setCurrentIndex (newIndex); + warning ("popupmenu value should be integer"); } else - warning ("popupmenu value not within valid display range"); + { + int newIndex = int (value(0)) - 1; + + if (newIndex >= 0 && newIndex < box->count ()) + { + if (newIndex != box->currentIndex ()) + box->setCurrentIndex (newIndex); + } + else + warning ("popupmenu value not within valid display range"); + } } } m_blockUpdate = false;