[svn]
r7683: vs-plugin/trunk/Nemerle.VsIntegration/GUI/GotoUsageForm.cs
VladD2
svnadmin at nemerle.org
Tue May 15 04:40:11 CEST 2007
Log:
Prevent NullReferenceException if GotoUsage found several locations and files not in project.
Author: VladD2
Date: Tue May 15 04:40:10 2007
New Revision: 7683
Modified:
vs-plugin/trunk/Nemerle.VsIntegration/GUI/GotoUsageForm.cs
Modified: vs-plugin/trunk/Nemerle.VsIntegration/GUI/GotoUsageForm.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/GUI/GotoUsageForm.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/GUI/GotoUsageForm.cs Tue May 15 04:40:10 2007
@@ -21,12 +21,25 @@
foreach (GotoInfo gotoInfo in gotoInfos)
{
ProjectInfo project = ProjectInfo.FindProject(gotoInfo.FilePath);
+ string text;
+ if (project == null)
+ {
+ string[] strs = File.ReadAllLines(gotoInfo.FilePath);
+ int line = gotoInfo.Line - 1;
+ if (line < strs.Length)
+ text = strs[line].Trim().Replace("\t", " ");
+ else
+ text = "???";
+ }
+ else
+ text = gotoInfo.GetLineOfCode(project.Project).Trim().Replace("\t", " ");
+
ListViewItem lvi = new ListViewItem(new string[]
{
Path.GetFileName(gotoInfo.FilePath),
gotoInfo.Line.ToString(),
gotoInfo.UsageTypeToString(),
- gotoInfo.GetLineOfCode(project.Project).Replace("\t", " ")
+ text
});
lvi.ToolTipText = gotoInfo.FilePath;
lvi.Tag = gotoInfo;
More information about the svn
mailing list