﻿using System.Xml;

namespace umbraco.editorControls.imagecropper
{
    public class DataTypeData : umbraco.cms.businesslogic.datatype.DefaultData
    {
        public DataTypeData(umbraco.cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) { }

        public override XmlNode ToXMl(XmlDocument data)
        {
            if (Value.ToString() != "") {
                XmlDocument xd = new XmlDocument();
                xd.LoadXml(Value.ToString());
                return data.ImportNode(xd.DocumentElement, true);
            } else {
                return base.ToXMl(data);
            }

        }
    }
}
﻿using System.Xml;

namespace umbraco.editorControls.imagecropper
{
    public class DataTypeData : umbraco.cms.businesslogic.datatype.DefaultData
    {
        public DataTypeData(umbraco.cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) { }

        public override XmlNode ToXMl(XmlDocument data)
        {
            if (Value!=null && Value.ToString() != "") {
                XmlDocument xd = new XmlDocument();
                xd.LoadXml(Value.ToString());
                return data.ImportNode(xd.DocumentElement, true);
            } else {
                return base.ToXMl(data);
            }

        }
    }
}
Fix U4-2711 add Null Check to ToXMl method
Fix U4-2711 add Null Check to ToXMl method

Fixes Object reference not set to an instance of an object. at
umbraco.editorControls.imagecropper.DataTypeData.ToXMl(XmlDocument data)
