From 8695368e290d993466d3c226bf58eb39c53eddaa Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 2 Sep 2007 10:23:28 +0000 Subject: [PATCH] Fix crash when selection begins or ends outside the visible screen. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19992 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TextMetrics.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 061b07fbb1..e1c9c845b1 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1703,6 +1703,11 @@ void TextMetrics::drawSelection(PainterInfo & pi, int x, int) const || bv_funcs::status(bv_, end) == bv_funcs::CUR_ABOVE) return; + if (beg.pit() < par_metrics_.begin()->first) + beg.pit() = par_metrics_.begin()->first; + if (end.pit() > par_metrics_.rbegin()->first) + end.pit() = par_metrics_.rbegin()->first; + ParagraphMetrics const & pm1 = par_metrics_[beg.pit()]; ParagraphMetrics const & pm2 = par_metrics_[end.pit()]; Row const & row1 = pm1.getRow(beg.pos(), beg.boundary());