Fixed the error handling when decoding invalid XML to avoid a Warning