Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 423ef26..5d0c6e4 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -517,9 +517,11 @@ void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e) void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { + Page* currentPage = m_pages.current(); + if ( !currentPage ) return; // no page yet --> initialization not finished (Mickeyl) QRect clipRect(cx, cy, cw, ch); - QRect pixmapRect(0, 0, m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); + QRect pixmapRect(0, 0, currentPage->pixmap()->width(), m_pages.current()->pixmap()->height()); QRect drawRect = pixmapRect.intersect(clipRect); - p->drawPixmap(drawRect.topLeft(), *(m_pages.current()->pixmap()), drawRect); + p->drawPixmap(drawRect.topLeft(), *(currentPage->pixmap()), drawRect); if (drawRect.right() < clipRect.right()) { |