]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/toolbar.cpp
Qt: fix crash in customize toolbar dialog.
[vlc] / modules / gui / qt4 / dialogs / toolbar.cpp
index 68e501e8508ac2fa57edf9abe2b0941bcc1e1ec0..f57b8f7c604edbaa6b0a78a0efcdbe52667a6c4f 100644 (file)
@@ -647,16 +647,14 @@ inline int DroppingController::getParentPosInLayout( QPoint point )
     QPoint origin = mapToGlobal ( point );
 
     QWidget *tempWidg = QApplication::widgetAt( origin );
+    if( tempWidg == NULL )
+        return -1;
 
-    int i = -1;
-    if( tempWidg != NULL)
+    int i = controlLayout->indexOf( tempWidg );
+    if( i == -1 )
     {
-        i = controlLayout->indexOf( tempWidg );
-        if( i == -1 )
-        {
-            i = controlLayout->indexOf( tempWidg->parentWidget() );
-            tempWidg = tempWidg->parentWidget();
-        }
+        i = controlLayout->indexOf( tempWidg->parentWidget() );
+        tempWidg = tempWidg->parentWidget();
     }
 
     /* Return the nearest position */