changeset 35365:fb054f36c3a9

Prevent negative array index read.
author ib
date Fri, 23 Nov 2012 14:03:37 +0000
parents dd38e289f246
children 92cafcf6f6b2
files gui/ui/main.c gui/ui/playbar.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/main.c	Fri Nov 23 13:35:31 2012 +0000
+++ b/gui/ui/main.c	Fri Nov 23 14:03:37 2012 +0000
@@ -511,6 +511,8 @@
    case wsP5MouseButton: value=-2.5f; goto rollerhandled;
    case wsP4MouseButton: value= 2.5f;
 rollerhandled:
+          if (currentselected != - 1)
+           {
           item=&guiApp.mainItems[currentselected];
           if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
            {
@@ -518,6 +520,7 @@
             btnModify( item->message,item->value );
             uiEventHandling( item->message,item->value );
            }
+           }
           break;
 
 /* moving */
--- a/gui/ui/playbar.c	Fri Nov 23 13:35:31 2012 +0000
+++ b/gui/ui/playbar.c	Fri Nov 23 14:03:37 2012 +0000
@@ -193,6 +193,8 @@
    case wsP5MouseButton: value=-2.5f; goto rollerhandled;
    case wsP4MouseButton: value= 2.5f;
 rollerhandled:
+        if (currentselected != - 1)
+         {
         item=&guiApp.playbarItems[currentselected];
         if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
 	 {
@@ -200,6 +202,7 @@
 	  btnModify( item->message,item->value );
 	  uiEventHandling( item->message,item->value );
 	 }
+	 }
 	break;
 /* --- */
    case wsMoveMouse: