From 8051328c2fb2c0e0a97ed88ee03bf7bc955dd8d8 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sun, 18 Oct 2009 13:49:16 +0000 Subject: [PATCH] Fixed null reference when validating an .xsd file with no root xs:schema element. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5078 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs index 9730b01bed..d4e09fd1c3 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs @@ -591,7 +591,9 @@ namespace ICSharpCode.XmlEditor try { XmlSchema schema = XmlSchema.Read(xmlReader, new ValidationEventHandler(SchemaValidation)); - schema.Compile(new ValidationEventHandler(SchemaValidation)); + if (schema != null) { + schema.Compile(new ValidationEventHandler(SchemaValidation)); + } } catch (XmlSchemaException ex) { DisplayValidationError(File.FileName, ex.Message, ex.LinePosition - 1, ex.LineNumber - 1); } catch (XmlException ex) {