From 3995bfd2f1da2b1c2354490b0685c884c032fdff Mon Sep 17 00:00:00 2001 From: Pascal Brisset Date: Tue, 16 Oct 2007 07:05:31 +0000 Subject: [PATCH] In message_bind: catch exceptions raised by values_of_string (should be done by callback :-( ) --- sw/lib/ocaml/pprz.ml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sw/lib/ocaml/pprz.ml b/sw/lib/ocaml/pprz.ml index db0ae05b5e..51fc40e2a5 100644 --- a/sw/lib/ocaml/pprz.ml +++ b/sw/lib/ocaml/pprz.ml @@ -455,10 +455,17 @@ module MessagesOfXml(Class:CLASS_Xml) = struct let message_bind = fun ?sender msg_name cb -> match sender with None -> - Ivy.bind (fun _ args -> cb args.(0) (snd (values_of_string args.(1)))) (sprintf "^([^ ]*) +(%s .*)" msg_name) + Ivy.bind + (fun _ args -> + let values = try snd (values_of_string args.(1)) with _ -> [] in + cb args.(0) values) + (sprintf "^([^ ]*) +(%s .*)" msg_name) | Some s -> - Ivy.bind (fun _ args -> cb s (snd (values_of_string args.(0)))) (sprintf "^%s +(%s .*)" s msg_name) - + Ivy.bind + (fun _ args -> + let values = try snd (values_of_string args.(0)) with _ -> [] in + cb s values) + (sprintf "^%s +(%s .*)" s msg_name) let message_answerer = fun sender msg_name cb -> let ivy_cb = fun _ args ->