Don't fabricate empty string in error case

This commit is contained in:
Dirkjan Ochtman 2022-11-26 12:52:13 -08:00
parent cd7e3b4224
commit f6a9d66288
1 changed files with 3 additions and 2 deletions

View File

@ -1,8 +1,9 @@
use std::collections::{BTreeMap, VecDeque};
use super::{Error, Id};
use xmlparser::{ElementEnd, Token, Tokenizer};
use crate::{Kind, Error, Id};
pub struct Deserializer<'cx, 'xml> {
pub(crate) local: &'xml str,
prefix: Option<&'xml str>,
@ -33,7 +34,7 @@ impl<'cx, 'xml> Deserializer<'cx, 'xml> {
Some(Ok(Node::Text(s))) => (s, true),
Some(Ok(_)) => return Err(Error::ExpectedScalar),
Some(Err(e)) => return Err(e),
None => return Ok(""),
None => return Err(Error::MissingValue(&Kind::Scalar)),
};
if element {