[monop] Fix NullReferenceException in monop
authorSteffen Kieß <s-kiess@web.de>
Fri, 8 Jan 2016 15:04:03 +0000 (16:04 +0100)
committerSteffen Kieß <s-kiess@web.de>
Fri, 8 Jan 2016 15:04:03 +0000 (16:04 +0100)
Fix a NullReferenceException in monop when printing a type name in a
namespace somewhere below System while working on a class which does not
have a namespace.

mcs/tools/monop/outline.cs

index 1e1dc25ae6d3f75dfbe02b9f8860b0a55acae1bb..5a97797c95b078efdd8f437f8fabf438eaebc568 100644 (file)
@@ -696,7 +696,7 @@ public class Outline {
                // automatically get the namespace imported by virtue of the
                // namespace {} block.
                //      
-               if (this.t.Namespace.StartsWith (t.Namespace + ".") || t.Namespace == this.t.Namespace)
+               if (this.t.Namespace != null && (this.t.Namespace.StartsWith (t.Namespace + ".") || t.Namespace == this.t.Namespace))
                        return type.Substring (t.Namespace.Length + 1);
        
                return type;