]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/stockitem.cpp
fix for handling from Francesco
[wxWidgets.git] / src / common / stockitem.cpp
index a559da2155b917966c6af17d94dc79cf26987b37..ee38d92f204cda59b6e0e7109a09cb09033ee448 100644 (file)
@@ -171,20 +171,16 @@ wxString wxGetStockLabel(wxWindowID id, long flags)
 
     if ( !(flags & wxSTOCK_WITH_MNEMONIC) )
     {
-        stockLabel = wxStripMenuCodes( stockLabel );
+        stockLabel = wxStripMenuCodes(stockLabel);
     }
 
 #if wxUSE_ACCEL
-
-    if (!stockLabel.empty() && (flags & wxSTOCK_WITH_ACCELERATOR))
+    if ( !stockLabel.empty() && (flags & wxSTOCK_WITH_ACCELERATOR) )
     {
-        stockLabel += _T("\t");
-
         wxAcceleratorEntry accel = wxGetStockAccelerator(id);
         if (accel.IsOk())
-            stockLabel += accel.ToString();
+            stockLabel << _T('\t') << accel.ToString();
     }
-
 #endif // wxUSE_ACCEL
 
     return stockLabel;
@@ -384,6 +380,9 @@ const char *wxGetStockGtkID(wxWindowID id)
 
 bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key)
 {
+    if (!id)
+        return false;
+
     GtkStockItem stock_item;
     if (gtk_stock_lookup (id, &stock_item))
     {