From c21452ce80b9ea144b7d67dc5ff00be42cdea060 Mon Sep 17 00:00:00 2001 From: Frederic Date: Tue, 20 Dec 2016 12:54:35 +0100 Subject: [PATCH] setPixel(): throw an error in case invalid coordinates are specified --- blup/frame.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/blup/frame.py b/blup/frame.py index 2d339b8..7833841 100644 --- a/blup/frame.py +++ b/blup/frame.py @@ -122,6 +122,10 @@ class Frame(object): for v in value: if v < 0 or v >= self.__dimension.depth: raise ValueError('pixel value not in depth range') + if x < 0 or x >= self.dimension.width: + raise ValueError('invalid x coordinate') + if y < 0 or y >= self.dimension.height: + raise ValueError('invalid y coordinate') self.__pixels[y][x] = value