]> git.sesse.net Git - vlc/commitdiff
fixes a infinite loop in the search function.
authorBenjamin Pracht <bigben@videolan.org>
Wed, 10 Dec 2003 12:57:12 +0000 (12:57 +0000)
committerBenjamin Pracht <bigben@videolan.org>
Wed, 10 Dec 2003 12:57:12 +0000 (12:57 +0000)
modules/gui/macosx/playlist.m

index 29bd0894115ecd09aaddcdbb60f9573edd4dda37..c97252d83ca43ef143b7034e9e56522f57a55037 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.m,v 1.46 2003/11/20 02:39:09 hartman Exp $
+ * $Id: playlist.m,v 1.47 2003/12/10 12:57:12 bigben Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
 
 - (IBAction)searchItem:(id)sender
 {
-    int i_current = 0;
+    int i_current = -1;
     NSString *o_current_name;
     NSString *o_current_author;
 
 
     if ([o_table_view selectedRow] == [o_table_view numberOfRows]-1 )
     {
-        i_current = 0;
+        i_current =-1;
     }
     else
     {
-        i_current = [o_table_view selectedRow]+1
+        i_current = [o_table_view selectedRow]; 
     }
 
-    while (i_current != [o_table_view selectedRow])
+    do
     {
+        i_current++;
+
         vlc_mutex_lock( &p_playlist->object_lock );
         o_current_name = [NSString stringWithUTF8String: 
             p_playlist->pp_items[i_current]->psz_name];
              [o_table_view scrollRowToVisible: i_current];
              break;
         }
-        if ( i_current == [o_table_view numberOfRows] - 1 )
-        {
-             i_current = 0;
-        }
-        else
+    if ( i_current == [o_table_view numberOfRows] - 1 )
         {
-             i_current++;
+             i_current = -1;
         }
     }
+    while (i_current != [o_table_view selectedRow]);
     vlc_object_release( p_playlist );
 }