From 052d2ab6f17e6ec239f368ee802a659be46098cc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 Jul 2010 01:18:49 +0000 Subject: Prevent GraphicsWidget from being assigned a surface which wouldn't fit in the widget. svn-id: r50641 --- gui/widget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gui/widget.cpp b/gui/widget.cpp index 9297cce344..14cb61006b 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -583,6 +583,11 @@ void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { if (!gfx || !gfx->pixels) return; + if (gfx->w > _w || gfx->h > _h) { + warning("GraphicsWidget has size %dx%d, but a surface with %dx%d is to be set", _w, _h, gfx->w, gfx->h); + return; + } + // TODO: add conversion to OverlayColor _gfx.copyFrom(*gfx); } -- cgit v1.2.3