delay: Correctly parse the content data.

This commit is contained in:
Emmanuel Gil Peyrot 2017-04-21 04:01:14 +01:00
parent cfadff3bc9
commit d39d13b7cb

View file

@ -20,10 +20,14 @@ pub fn parse_delay(root: &Element) -> Result<Delay, Error> {
} }
let from = root.attr("from").and_then(|value| value.parse().ok()); let from = root.attr("from").and_then(|value| value.parse().ok());
let stamp = root.attr("stamp").ok_or(Error::ParseError("Mandatory argument 'stamp' not present in delay element."))?.to_owned(); let stamp = root.attr("stamp").ok_or(Error::ParseError("Mandatory argument 'stamp' not present in delay element."))?.to_owned();
let data = match root.text().as_ref() {
"" => None,
text => Some(text.to_owned()),
};
Ok(Delay { Ok(Delay {
from: from, from: from,
stamp: stamp, stamp: stamp,
data: None, data: data,
}) })
} }