Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv28308

Modified Files:
        LabelTrack.cpp 
Log Message:
Prevent crash when tabbing in label track with no labels

Index: LabelTrack.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/LabelTrack.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- LabelTrack.cpp      11 Apr 2007 06:52:27 -0000      1.79
+++ LabelTrack.cpp      23 May 2007 23:31:19 -0000      1.80
@@ -1451,16 +1451,18 @@
       switch (keyCode) {
 
       case WXK_TAB:
-         if (event.ShiftDown()) {
-            mSelIndex = (int)mLabels.Count() - 1;
-         } else {
-            mSelIndex = 0;
+         if (!mLabels.IsEmpty()) {
+            if (event.ShiftDown()) {
+               mSelIndex = (int)mLabels.Count() - 1;
+            } else {
+               mSelIndex = 0;
+            }
+            
+            mCurrentCursorPos = mLabels[mSelIndex]->title.Length();
+            //Set the selection region to be equal to the selection bounds of 
the tabbed-to label.
+            newSel0 = mLabels[mSelIndex]->t;
+            newSel1 = mLabels[mSelIndex]->t1;
          }
-         
-         mCurrentCursorPos = mLabels[mSelIndex]->title.Length();
-         //Set the selection region to be equal to the selection bounds of the 
tabbed-to label.
-         newSel0 = mLabels[mSelIndex]->t;
-         newSel1 = mLabels[mSelIndex]->t1;
          break;
 
       default:


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to