diff options
author | Henrik Backe <henrik@backe.eu> | 2004-09-27 19:23:18 +0000 |
---|---|---|
committer | Henrik Backe <henrik@backe.eu> | 2004-09-27 19:23:18 +0000 |
commit | 9c97f4d2a5b229a09eaf735a279f3a26a71c4912 (patch) | |
tree | db332dd934fc505cf766cbc67b3b324e134a878f /apps | |
parent | 4341211ddc300e7f64e2935f8e19052d1c12c7ed (diff) |
My previous commit broke wrap around browsing in select_bookmoark()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5121 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/bookmark.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index 236b2e4cde..9b50ae444a 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -627,11 +627,8 @@ static char* select_bookmark(const char* bookmark_file_name) while(true) { if(bookmark_id < 0) - { - bookmark_id = 0; - bookmark_id_prev = -1; - } - if(bookmark_id == bookmark_count) + bookmark_id = bookmark_count -1; + if(bookmark_id >= bookmark_count) bookmark_id = 0; if (bookmark_id != bookmark_id_prev) @@ -643,7 +640,7 @@ static char* select_bookmark(const char* bookmark_file_name) if (!bookmark) { /* if there were no bookmarks in the file, delete the file and exit. */ - if(bookmark_id == 0) + if(bookmark_id <= 0) { splash(HZ, true, str(LANG_BOOKMARK_LOAD_EMPTY)); remove(bookmark_file_name); @@ -684,9 +681,10 @@ static char* select_bookmark(const char* bookmark_file_name) #endif /* User wants to delete this bookmark */ delete_bookmark(bookmark_file_name, bookmark_id); - bookmark_id_prev=-1; - bookmark_id--; + bookmark_id_prev=-2; bookmark_count--; + if(bookmark_id >= bookmark_count) + bookmark_id = bookmark_count -1; while (button_get(false)); /* clear button queue */ break; @@ -951,6 +949,9 @@ static char* get_bookmark(const char* bookmark_file, int bookmark_count) if (file < 0) return NULL; + if (bookmark_count < 0) + return NULL; + /* Get the requested bookmark */ while (read_count < bookmark_count) { |