[vlc-commits] commit: ncurses: missing check in CheckIdx() ( Rafaël Carré )

git at videolan.org git at videolan.org
Fri Oct 29 17:46:54 CEST 2010


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Fri Oct 29 17:46:26 2010 +0200| [9f0a713cd27838ff3d7c226007d90d6170860951] | committer: Rafaël Carré 

ncurses: missing check in CheckIdx()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f0a713cd27838ff3d7c226007d90d6170860951
---

 modules/gui/ncurses.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 07c4239..cf558db 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -328,9 +328,10 @@ next:
  *****************************************************************************/
 static void CheckIdx(intf_sys_t *p_sys)
 {
+    int lines = p_sys->i_box_lines_total - 1;
     int height = LINES - p_sys->i_box_y - 2;
-    if (height > p_sys->i_box_lines_total - 1)
-        height = p_sys->i_box_lines_total - 1;
+    if (height > lines - 1)
+        height = lines - 1;
 
     /* make sure the new index is within the box */
     if (p_sys->i_box_idx <= 0)
@@ -338,9 +339,9 @@ static void CheckIdx(intf_sys_t *p_sys)
         p_sys->i_box_idx = 0;
         p_sys->i_box_start = 0;
     }
-    else if (p_sys->i_box_idx >= p_sys->i_box_lines_total - 1)
+    else if (p_sys->i_box_idx >= lines - 1 && lines > 0)
     {
-        p_sys->i_box_idx = p_sys->i_box_lines_total - 1;
+        p_sys->i_box_idx = lines - 1;
         p_sys->i_box_start = p_sys->i_box_idx - height;
     }
 



More information about the vlc-commits mailing list