]> git.lyx.org Git - features.git/commitdiff
Fix bug #6351: Crash when editing the unit on a number
authorEnrico Forestieri <forenr@lyx.org>
Thu, 26 Nov 2009 01:56:50 +0000 (01:56 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Thu, 26 Nov 2009 01:56:50 +0000 (01:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32211 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathFrac.cpp

index 7f5323b8d611548a3f38201fe7ca8f100ffabe36..3a1fac12274f6812d54d9318b69fb57296b5808f 100644 (file)
@@ -42,7 +42,9 @@ InsetMathFracBase::InsetMathFracBase(Buffer * buf, idx_type ncells)
 
 bool InsetMathFracBase::idxUpDown(Cursor & cur, bool up) const
 {
-       InsetMath::idx_type target = !up; // up ? 0 : 1, since upper cell has idx 0
+       // If we only have one cell, target = 0, otherwise
+       // target = up ? 0 : 1, since upper cell has idx 0
+       InsetMath::idx_type target = nargs() > 1 ? !up : 0;
        if (cur.idx() == target)
                return false;
        cur.idx() = target;