From d39d13b7cb936ec82170e52ba48cb88b7138fb43 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 21 Apr 2017 04:01:14 +0100 Subject: [PATCH] delay: Correctly parse the content data. --- src/delay.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/delay.rs b/src/delay.rs index f4f5935..b54dd04 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -20,10 +20,14 @@ pub fn parse_delay(root: &Element) -> Result { } 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 data = match root.text().as_ref() { + "" => None, + text => Some(text.to_owned()), + }; Ok(Delay { from: from, stamp: stamp, - data: None, + data: data, }) }