diff options
author | Mike Krüger <mikkrg@microsoft.com> | 2018-09-12 08:40:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 08:40:34 +0300 |
commit | 42be91afe3ba525f327837045ca91fd2c834cd7b (patch) | |
tree | b8a31dd58289af3205c534da3da18eba52dbac2f | |
parent | 3be92db886ff117dfbb6575c743bfdbf9a18be3c (diff) | |
parent | 09eeac8a144e9bb2cdb225d638fa2d1ae65dee91 (diff) |
Merge pull request #5897 from mono/master-issue5873
Fixes issue #5873 Exception when using syntax highlighting in VS for
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs index d5d6323004..6657b164c2 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs @@ -301,16 +301,20 @@ namespace MonoDevelop.Ide.Editor.Highlighting var entry = stream.GetNextEntry (); var newBundle = new LanguageBundle (Path.GetFileNameWithoutExtension (file), file); while (entry != null) { - if (entry.IsFile && !entry.IsCrypted) { - if (stream.CanDecompressEntry) { - byte [] data = new byte [entry.Size]; - stream.Read (data, 0, (int)entry.Size); - LoadFile (newBundle, entry.Name, () => new MemoryStream (data), () => new MemoryStreamProvider (data, entry.Name)); + try { + if (entry.IsFile && !entry.IsCrypted) { + if (stream.CanDecompressEntry) { + byte[] data = new byte[entry.Size]; + stream.Read (data, 0, (int)entry.Size); + LoadFile (newBundle, entry.Name, () => new MemoryStream (data), () => new MemoryStreamProvider (data, entry.Name)); + } } - } + } catch (Exception e) { + LoggingService.LogError ("Error while reading compressed entry " + entry.Name, e); + } entry = stream.GetNextEntry (); } - languageBundles.Add (newBundle); + languageBundles.Add (newBundle); return newBundle; } } catch (Exception e) { @@ -373,8 +377,13 @@ namespace MonoDevelop.Ide.Editor.Highlighting // e.g. xaml.json, where scopeName is on 2nd line. var queueOfPrereadLines = new Queue<string> (); var nameLine = file.ReadLine (); + if (nameLine == null) + return false; queueOfPrereadLines.Enqueue (nameLine); var versionLine = file.ReadLine (); + if (versionLine == null) + return false; + queueOfPrereadLines.Enqueue (versionLine); var match = jsonNameRegex.Match (nameLine); if (match.Success) { |