Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2013-08-14 21:48:08 +0400
committerMike Krüger <mkrueger@xamarin.com>2013-08-14 21:48:08 +0400
commit0aec1252f3a91f537ac43aaba6f0946900757f03 (patch)
tree136870569f34bd69047da846b2a35c5d04dcf6b1 /main/src/core/Mono.Texteditor
parenta50ab68b91bea447e34773ba6ba86dad8a2805c6 (diff)
Fixed 'Bug 13973 - NRE in syntax highlighting '.
Diffstat (limited to 'main/src/core/Mono.Texteditor')
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs7
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs5
2 files changed, 8 insertions, 4 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
index 6b3c3d9c0e..ff2c386cec 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
@@ -200,10 +200,10 @@ namespace Mono.TextEditor.Highlighting
public class SpanParser
{
- protected SyntaxMode mode;
+ protected readonly SyntaxMode mode;
protected CloneableStack<Span> spanStack;
protected Stack<Rule> ruleStack;
- protected TextDocument doc;
+ protected readonly TextDocument doc;
internal Func<bool> IsAtWordStart = () => true;
int maxEnd;
@@ -257,6 +257,8 @@ namespace Mono.TextEditor.Highlighting
if (mode == null)
throw new ArgumentNullException ("mode");
this.doc = mode.Document;
+ if (this.doc == null)
+ throw new ArgumentException ("Syntax mode isn't bound to any document.", "mode");
this.mode = mode;
this.SpanStack = spanStack;
this.CurRule = mode;
@@ -844,3 +846,4 @@ namespace Mono.TextEditor.Highlighting
}
}
}
+
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
index 590535b1d1..90f103d76c 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
@@ -257,13 +257,13 @@ namespace Mono.TextEditor.Highlighting
{
return !span.StopAtEol || span.StopAtEol && !string.IsNullOrEmpty (span.Continuation) &&
line != null && doc.GetTextAt (line).Trim ().EndsWith (span.Continuation, StringComparison.Ordinal);
- }
+ }
public void InnerRun ()
{
bool doUpdate = false;
int startLine = doc.OffsetToLineNumber (startOffset);
- if (startLine < 0)
+ if (startLine < 0 || mode.Document == null)
return;
try {
var lineSegment = doc.GetLine (startLine);
@@ -547,3 +547,4 @@ namespace Mono.TextEditor.Highlighting
}
}
}
+