Revision: 7316
Author:   nogu.dev
Date:     Sun Sep 18 23:31:24 2011
Log:      * qt3/pref/customwidgets.cpp
  - (CustomChoiceCombo::slotActivated): Avoid crash
    by checking if variable "choice" is NULL.
* qt4/pref/customwidgets.cpp
  - (CustomChoiceCombo::slotActivated): Ditto.
http://code.google.com/p/uim/source/detail?r=7316

Modified:
 /trunk/qt3/pref/customwidgets.cpp
 /trunk/qt4/pref/customwidgets.cpp

=======================================
--- /trunk/qt3/pref/customwidgets.cpp   Tue May 24 07:49:05 2011
+++ /trunk/qt3/pref/customwidgets.cpp   Sun Sep 18 23:31:24 2011
@@ -327,9 +327,15 @@
     free( m_custom->value->as_choice->label );
     free( m_custom->value->as_choice->desc );

-    m_custom->value->as_choice->symbol = strdup( choice->symbol );
-    m_custom->value->as_choice->label  = strdup( choice->label );
-    m_custom->value->as_choice->desc   = strdup( choice->desc );
+    if ( choice ) {
+        m_custom->value->as_choice->symbol = strdup( choice->symbol );
+        m_custom->value->as_choice->label  = strdup( choice->label );
+        m_custom->value->as_choice->desc   = strdup( choice->desc );
+    } else {
+        m_custom->value->as_choice->symbol = strdup( "" );
+        m_custom->value->as_choice->label  = strdup( "" );
+        m_custom->value->as_choice->desc   = strdup( "" );
+    }

     setCustom( m_custom );
 }
=======================================
--- /trunk/qt4/pref/customwidgets.cpp   Sun Sep 18 19:48:32 2011
+++ /trunk/qt4/pref/customwidgets.cpp   Sun Sep 18 23:31:24 2011
@@ -341,9 +341,15 @@
     free( m_custom->value->as_choice->label );
     free( m_custom->value->as_choice->desc );

-    m_custom->value->as_choice->symbol = strdup( choice->symbol );
-    m_custom->value->as_choice->label  = strdup( choice->label );
-    m_custom->value->as_choice->desc   = strdup( choice->desc );
+    if ( choice ) {
+        m_custom->value->as_choice->symbol = strdup( choice->symbol );
+        m_custom->value->as_choice->label  = strdup( choice->label );
+        m_custom->value->as_choice->desc   = strdup( choice->desc );
+    } else {
+        m_custom->value->as_choice->symbol = strdup( "" );
+        m_custom->value->as_choice->label  = strdup( "" );
+        m_custom->value->as_choice->desc   = strdup( "" );
+    }

     setCustom( m_custom );
 }

Reply via email to