1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-02-26 05:46:00 +01:00

Deal with non-existent editors for a file

This commit is contained in:
rmaddy 2004-02-11 16:50:51 +00:00
parent b3954913a0
commit 6782afc678

View File

@ -409,7 +409,7 @@ public class MarkGroup extends AbstractActionGroup
public static void updateMarkFromDelete(Editor editor, HashMap marks, int delStartOff, int delLength)
{
// Skip all this work if there are no marks
if (marks != null && marks.size() > 0)
if (marks != null && marks.size() > 0 && editor != null)
{
// Calculate the logical position of the start and end of the deleted text
int delEndOff = delStartOff + delLength;
@ -465,7 +465,7 @@ public class MarkGroup extends AbstractActionGroup
*/
public static void updateMarkFromInsert(Editor editor, HashMap marks, int insStartOff, int insLength)
{
if (marks != null && marks.size() > 0)
if (marks != null && marks.size() > 0 && editor != null)
{
int insEndOff = insStartOff + insLength;
LogicalPosition insStart = editor.offsetToLogicalPosition(insStartOff);
@ -553,7 +553,14 @@ public class MarkGroup extends AbstractActionGroup
{
Editor[] editors = EditorFactory.getInstance().getEditors(doc);
return editors[0];
if (editors.length > 0)
{
return editors[0];
}
else
{
return null;
}
}
}