diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/ChangeLog | 5 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs | 17 |
2 files changed, 17 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/ChangeLog b/main/src/core/MonoDevelop.Ide/ChangeLog index edc70d85a1..b62b0b8c60 100644 --- a/main/src/core/MonoDevelop.Ide/ChangeLog +++ b/main/src/core/MonoDevelop.Ide/ChangeLog @@ -1,5 +1,10 @@ 2009-09-18 Mike Krüger <mkrueger@novell.com> + * MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs: Fixed + possible null reference. + +2009-09-18 Mike Krüger <mkrueger@novell.com> + * MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs: Fixed generics in component types. diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs index 846579285b..799fd2c672 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs @@ -246,18 +246,25 @@ namespace MonoDevelop.Ide.CodeTemplates } sb.Append (s); } else { - link.AddLink (new Segment (sb.Length, variableDecarations[name].Default.Length)); - sb.Append (variableDecarations[name].Default); + AddDefaultValue (sb, link, name); } - } else { - link.AddLink (new Segment (sb.Length, variableDecarations[name].Default.Length)); - sb.Append (variableDecarations[name].Default); + } else { + AddDefaultValue (sb, link, name); } } sb.Append (code.Substring (lastOffset, code.Length - lastOffset)); result.Code = sb.ToString (); return result; } + + void AddDefaultValue (StringBuilder sb, TextLink link, string name) + { + if (string.IsNullOrEmpty (variableDecarations[name].Default)) + return; + link.AddLink (new Segment (sb.Length, variableDecarations[name].Default.Length)); + sb.Append (variableDecarations[name].Default); + } + public string IndentCode (string code, string indent) { |