]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/control.cpp
add wxMBConvStrictUTF8 class implementing just UTF-8 conversion, without support...
[wxWidgets.git] / src / univ / control.cpp
index 8a692bf840cf08682cbd0497e022850f801a58eb..8e2a06e9de8a2f6a1042af3dafb0f60a95cc842d 100644 (file)
@@ -93,17 +93,19 @@ int wxControl::FindAccelIndex(const wxString& label, wxString *labelOnly)
     }
 
     int indexAccel = -1;
-    for ( const wxChar *pc = label; *pc != wxT('\0'); pc++ )
+    for ( wxString::const_iterator pc = label.begin(); pc != label.end(); ++pc )
     {
         if ( *pc == MNEMONIC_PREFIX )
         {
-            pc++; // skip it
-            if ( *pc != MNEMONIC_PREFIX )
+            ++pc; // skip it
+            if ( pc == label.end() )
+                break;
+            else if ( *pc != MNEMONIC_PREFIX )
             {
                 if ( indexAccel == -1 )
                 {
                     // remember it (-1 is for MNEMONIC_PREFIX itself
-                    indexAccel = pc - label.c_str() - 1;
+                    indexAccel = pc - label.begin() - 1;
                 }
                 else
                 {