[gnome-characters] characterList: Check out-of-bounds of rows



commit 8616c67b5ede980a2117be1aa0186c3456f8d4a9
Author: Daiki Ueno <dueno src gnome org>
Date:   Wed Feb 11 07:25:04 2015 +0900

    characterList: Check out-of-bounds of rows

 src/characterList.js |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/characterList.js b/src/characterList.js
index bb19f21..5cc262e 100644
--- a/src/characterList.js
+++ b/src/characterList.js
@@ -215,8 +215,8 @@ const CharacterListWidget = new Lang.Class({
         // Redraw rows within the clipped region.
         let [x1, y1, x2, y2] = cr.clipExtents();
         let cellSize = getCellSize(this._fontDescription);
-        let start = Math.floor(y1 / cellSize);
-        let end = Math.ceil(y2 / cellSize);
+        let start = Math.max(0, Math.floor(y1 / cellSize));
+        let end = Math.min(this._rows.length, Math.ceil(y2 / cellSize));
         for (let index = start; index < end; index++) {
             this._rows[index].draw(cr, 0, index * cellSize,
                                    allocation.width, cellSize);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]