aboutsummaryrefslogtreecommitdiff
path: root/lib/segment.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/segment.ml')
-rw-r--r--lib/segment.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/segment.ml b/lib/segment.ml
index ce50f78..7023098 100644
--- a/lib/segment.ml
+++ b/lib/segment.ml
@@ -15,7 +15,8 @@ let next (stream : (signal, async) stream) : (signal, sync) stream Lwt.t =
(** [get stream] is a promise containing a single Xml element of [stream]. *)
let get (stream : (signal, async) stream) : element Lwt.t =
- let* signal = next stream
- in match tree signal with
+ let* signal = next stream in
+ let* el = tree signal
+ in match el with
| Some xml -> Lwt.return xml
| None -> Lwt.fail (InvalidStanza (signal |> write_xml |> to_string))