# HG changeset patch # User Jacob Carlborg # Date 1286216282 -7200 # Node ID 51f05fd6a6262357eaa348ce55517d8c3dcf28a5 # Parent 9a575087b961c8f425b42dd8eae8f842a26ba7b3 Merged changes from dsource repository. diff -r 9a575087b961 -r 51f05fd6a626 orange/serialization/archives/XMLArchive.d --- a/orange/serialization/archives/XMLArchive.d Mon Oct 04 18:27:21 2010 +0200 +++ b/orange/serialization/archives/XMLArchive.d Mon Oct 04 20:18:02 2010 +0200 @@ -416,8 +416,16 @@ lastElement = tmp; auto runtimeType = getValueOfAttribute(Attributes.runtimeTypeAttribute); + + if (!runtimeType) + return T.init; + auto name = fromDataType!(string)(runtimeType); - id = getValueOfAttribute(Attributes.idAttribute); + id = getValueOfAttribute(Attributes.idAttribute); + + if (!id) + return T.init; + T result = cast(T) newInstance(name); addUnarchivedReference(result, id); @@ -473,10 +481,17 @@ return T.init; lastElement = element; - auto length = getValueOfAttribute(Attributes.lengthAttribute); + auto length = getValueOfAttribute(Attributes.lengthAttribute); + + if (!length) + return T.init; + value.length = fromDataType!(size_t)(length); slice.id = getValueOfAttribute(Attributes.idAttribute); + if (!slice.id) + return T.init; + addUnarchivedSlice(value, slice.id); return value; @@ -509,6 +524,9 @@ lastElement = element; id = getValueOfAttribute(Attributes.idAttribute); + + if (!id) + return T.init; T result = new BaseTypeOfPointer!(T); @@ -617,7 +635,7 @@ } return doc.Node.invalid; - } + } } private DataType getValueOfAttribute (DataType attribute, doc.Node element = doc.Node.invalid) @@ -639,7 +657,9 @@ else errorCallback(new ArchiveException(`Could not unarchive the value of the attribute "` ~ to!(string)(attribute) ~ `" due to malformed data.`, __FILE__, __LINE__), [attribute]); } - } + } + + return null; } private void addArchivedReference (T) (T value, DataType id)