Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit f10ee287 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

AbstractXMLType: Throw meaningful error message on access to Null-References.

parent 9b792ea4
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml; using System.Xml;
using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Exceptions;
...@@ -136,12 +137,14 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Common { ...@@ -136,12 +137,14 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Common {
protected virtual TableData ReadTableData(string baseElement, string entryElement, Dictionary<string, string> mapping) protected virtual TableData ReadTableData(string baseElement, string entryElement, Dictionary<string, string> mapping)
{ {
var entries = BaseNode.SelectNodes( try {
XMLHelper.QueryLocalName(baseElement, entryElement)); var entries = BaseNode.SelectNodes(XMLHelper.QueryLocalName(baseElement, entryElement));
if (entries != null && entries.Count > 0) { if (entries != null && entries.Count > 0) {
return XMLHelper.ReadTableData(mapping, entries); return XMLHelper.ReadTableData(mapping, entries);
}
} catch (NullReferenceException) {
throw new VectoException($"Could not find element: {baseElement} {entryElement}");
} }
return null; return null;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment