[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kate/utils
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2009-06-04 15:48:43
Message-ID: 1244130523.262240.3762.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 977542 by dhaumann:

fix crash:
"ASSERT: \"!isEmpty()\" in file
qt4/include/QtCore/qlist.h, line 252")
    at qt-copy/src/corelib/global/qglobal.cpp:2017
9  0xb6b02807 in qFatal (msg=0xb6c366b8 "ASSERT: \"%s\" in file %s,
 line %d") at qt-copy/src/corelib/global/qglobal.cpp:2216
10 0xb6b028c5 in qt_assert (assertion=0xb45f3d80 "!isEmpty()",
file=0xb45f3d54 "/home/dh/kde/run/qt4/include/QtCore/qlist.h", line=252)
     at qt-copy/src/corelib/global/qglobal.cpp:1786
11 0xb44ee687 in QList<QString>::first (this=0xbff85194) at
/home/dh/kde/run/qt4/include/QtCore/qlist.h:252
12 0xb45a7e51 in KateCommands::CoreCommands::exec (this=0x9309350,
view=0x9656b68, _cmd=@0xbff852b8, errorMsg=@0xbff85278,
range=@0xbff85224) at kate/utils/katecmds.cpp:210
13 0xb456d3eb in KateCmdLineEdit::slotReturnPressed (this=0x97a2fc0,
text=@0xbff853fc) at kate/view/kateviewhelpers.cpp:485

 M  +26 -16    katecmds.cpp  


--- trunk/KDE/kdelibs/kate/utils/katecmds.cpp #977541:977542
@@ -205,29 +205,39 @@
     v->doc()->printDialog();
     return true;
   }
-  else if ( cmd == "set-indent-mode" )
+
+  // ALL commands that take a string argument
+  else if ( cmd == "set-indent-mode" ||
+            cmd == "set-highlight" ||
+            cmd == "set-mode" )
   {
-    v->doc()->config()->setIndentationMode( args.first() );
-    return true;
-  }
-  else if ( cmd == "set-highlight" )
-  {
-    if ( v->doc()->setHighlightingMode( args.first()) )
+    // need at least one item, otherwise args.first() crashes
+    if ( ! args.count() )
+      KCC_ERR( i18n("Missing argument. Usage: %1 <value>",  cmd ) );
+
+    if ( cmd == "set-indent-mode" )
     {
-      ((KateDocument*)v->doc())->setDontChangeHlOnSave ();
+      v->doc()->config()->setIndentationMode( args.first() );
       return true;
     }
+    else if ( cmd == "set-highlight" )
+    {
+      if ( v->doc()->setHighlightingMode( args.first()) )
+      {
+        ((KateDocument*)v->doc())->setDontChangeHlOnSave ();
+        return true;
+      }
 
-    KCC_ERR( i18n("No such highlighting '%1'",  args.first() ) );
-  }
-  else if ( cmd == "set-mode" )
-  {
-    if ( v->doc()->setMode( args.first()) )
-      return true;
+      KCC_ERR( i18n("No such highlighting '%1'",  args.first() ) );
+    }
+    else if ( cmd == "set-mode" )
+    {
+      if ( v->doc()->setMode( args.first()) )
+        return true;
 
-    KCC_ERR( i18n("No such mode '%1'",  args.first() ) );
+      KCC_ERR( i18n("No such mode '%1'",  args.first() ) );
+    }
   }
-
   // ALL commands that takes exactly one integer argument.
   else if ( cmd == "set-tab-width" ||
             cmd == "set-indent-width" ||
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic