ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=459cf7383d85e7c2cb2b1d1fa7f209a402d6ab23

commit 459cf7383d85e7c2cb2b1d1fa7f209a402d6ab23
Author: Andy Williams <a...@andywilliams.me>
Date:   Sun Jan 31 09:01:44 2016 +0000

    [zoom] Fix some potential crashes when zooming.
    
    Generally just being a little more defensive against
    potential errors.
---
 src/bin/termpty.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 11dbcda..98240fb 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -652,6 +652,9 @@ termpty_line_length(const Termcell *cells, ssize_t nb_cells)
 {
    ssize_t len = nb_cells;
 
+   if (!cells)
+     return 0;
+
    for (len = nb_cells - 1; len >= 0; len--)
      {
         const Termcell *cell = cells + len;
@@ -784,9 +787,11 @@ termpty_row_length(Termpty *ty, int y)
    ssize_t wret;
    Termcell *cells = termpty_cellrow_get(ty, y, &wret);
 
+   if (cells)
+     return 0;
    if (y >= 0)
      return termpty_line_length(cells, ty->w);
-   return cells ? wret : 0;
+   return wret;
 }
 
 ssize_t

-- 


Reply via email to