X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatscene.cpp;h=c24933a280fdf0f41bc07ad5ed5f842553422655;hp=f71c85725f983bda70f9de68905835c064efed55;hb=954b1a6f53da55f9713fb4e75a2fb46dae7d9df8;hpb=a3aaabf6254c8c5439af8982cc613c4ced3f50ed diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index f71c8572..c24933a2 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -573,9 +573,14 @@ void ChatScene::updateSceneRect(qreal width) { } // the following call should be safe. If it crashes something went wrong during insert/remove - ChatLine *firstLine = _lines.at(_firstLineRow); - ChatLine *lastLine = _lines.last(); - updateSceneRect(QRectF(0, firstLine->pos().y(), width, lastLine->pos().y() + lastLine->height() - firstLine->pos().y())); + if(_firstLineRow < _lines.count()) { + ChatLine *firstLine = _lines.at(_firstLineRow); + ChatLine *lastLine = _lines.last(); + updateSceneRect(QRectF(0, firstLine->pos().y(), width, lastLine->pos().y() + lastLine->height() - firstLine->pos().y())); + } else { + // empty scene rect + updateSceneRect(QRectF(0, 0, width, 0)); + } } void ChatScene::updateSceneRect(const QRectF &rect) {