Commit 757cb4ca authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed bug #33922

parent adb3f67e
...@@ -1649,6 +1649,9 @@ CParagraphContentWithParagraphLikeContent.prototype.Get_ElementByPos = function( ...@@ -1649,6 +1649,9 @@ CParagraphContentWithParagraphLikeContent.prototype.Get_ElementByPos = function(
return this; return this;
var CurPos = ContentPos.Get(Depth); var CurPos = ContentPos.Get(Depth);
if (!this.Content[CurPos])
return null;
return this.Content[CurPos].Get_ElementByPos(ContentPos, Depth + 1); return this.Content[CurPos].Get_ElementByPos(ContentPos, Depth + 1);
}; };
CParagraphContentWithParagraphLikeContent.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth) CParagraphContentWithParagraphLikeContent.prototype.Get_PosByDrawing = function(Id, ContentPos, Depth)
......
...@@ -3561,6 +3561,8 @@ CMathContent.prototype.Get_ParaContentPos = function(bSelection, bStart, Content ...@@ -3561,6 +3561,8 @@ CMathContent.prototype.Get_ParaContentPos = function(bSelection, bStart, Content
else else
{ {
var nPos = (true !== bSelection ? this.CurPos : (false !== bStart ? this.Selection.StartPos : this.Selection.EndPos)); var nPos = (true !== bSelection ? this.CurPos : (false !== bStart ? this.Selection.StartPos : this.Selection.EndPos));
nPos = Math.max(0, Math.min(nPos, this.Content.length - 1));
ContentPos.Add(nPos); ContentPos.Add(nPos);
if (undefined !== this.Content[nPos]) if (undefined !== this.Content[nPos])
...@@ -3576,17 +3578,20 @@ CMathContent.prototype.Set_ParaContentPos = function(ContentPos, Depth) ...@@ -3576,17 +3578,20 @@ CMathContent.prototype.Set_ParaContentPos = function(ContentPos, Depth)
if (undefined === CurPos || CurPos < 0) if (undefined === CurPos || CurPos < 0)
{ {
this.CurPos = 0; this.CurPos = 0;
this.Content[this.CurPos].Cursor_MoveToStartPos(); if (this.Content[this.CurPos])
this.Content[this.CurPos].Cursor_MoveToStartPos();
} }
else if (CurPos > this.Content.length - 1) else if (CurPos > this.Content.length - 1)
{ {
this.CurPos = this.Content.length - 1; this.CurPos = this.Content.length - 1;
this.Content[this.CurPos].Cursor_MoveToEndPos(false); if (this.Content[this.CurPos])
this.Content[this.CurPos].Cursor_MoveToEndPos(false);
} }
else else
{ {
this.CurPos = CurPos; this.CurPos = CurPos;
this.Content[this.CurPos].Set_ParaContentPos(ContentPos, Depth + 1); if (this.Content[this.CurPos])
this.Content[this.CurPos].Set_ParaContentPos(ContentPos, Depth + 1);
} }
}; };
CMathContent.prototype.Selection_IsEmpty = function() CMathContent.prototype.Selection_IsEmpty = function()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment