Attenuate bug 4346 impact: crash -> assertion.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27079 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-10-24 08:49:31 +00:00
parent aeeb44d2e2
commit de94db1bcb

View File

@ -1317,7 +1317,8 @@ void TextMetrics::newParMetricsUp()
// y is screen coordinate
pit_type TextMetrics::getPitNearY(int y)
{
LASSERT(!text_->paragraphs().empty(), /**/);
LASSERT(!text_->paragraphs().empty(), return -1);
LASSERT(!par_metrics_.empty(), return -1);
LYXERR(Debug::DEBUG, "y: " << y << " cache size: " << par_metrics_.size());
// look for highest numbered paragraph with y coordinate less than given y
@ -1400,7 +1401,7 @@ Inset * TextMetrics::editXY(Cursor & cur, int x, int y)
cur.bv().coordCache().dump();
}
pit_type pit = getPitNearY(y);
LASSERT(pit != -1, /**/);
LASSERT(pit != -1, return 0);
Row const & row = getRowNearY(y, pit);
bool bound = false;
@ -1454,6 +1455,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
{
LASSERT(text_ == cur.text(), /**/);
pit_type pit = getPitNearY(y);
LASSERT(pit != -1, return);
ParagraphMetrics const & pm = par_metrics_[pit];
@ -1490,7 +1492,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
Inset * TextMetrics::checkInsetHit(int x, int y)
{
pit_type pit = getPitNearY(y);
LASSERT(pit != -1, /**/);
LASSERT(pit != -1, return 0);
Paragraph const & par = text_->paragraphs()[pit];
ParagraphMetrics const & pm = par_metrics_[pit];