Commits

arkdro committed d24dd99

fix in handling one item list

  • Participants
  • Parent commits 566025d

Comments (0)

Files changed (1)

ocaml/src/odec_port.ml

 let t_mult2 = function
   | ET_List [] ->
     None
-  | ET_List [x] ->
-    Some x
   | ET_List list ->
     Some (mult_list list)
 
   | ET_Tuple [ET_Atom "info"; t] ->
     let res = get_info t in
     Some t, res
-  | ET_Tuple [ET_Atom "ms"; (ET_List _) as t] ->
-    match t_mult2 t with
-    | Some (ET_Bignum r) ->
-      let res2 = create_decimal r in
-      Some t, ET_Tuple [ET_Atom "ok"; res2]
-    | None ->
-      Some t, ET_Tuple [ET_Atom "error"; ET_Atom "no_data"]
+  | ET_Tuple [ET_Atom "mult_list"; (ET_List [_]) as t] ->
+    Some t, ET_Tuple [ET_Atom "error"; ET_Atom "need_list_to_multiply"]
+  | ET_Tuple [ET_Atom "mult_list"; (ET_List _) as t] ->
+    (
+      match t_mult2 t with
+      | Some (ET_Bignum r) ->
+        let res2 = create_decimal r in
+        Some t, ET_Tuple [ET_Atom "ok"; res2]
+      | None ->
+        Some t, ET_Tuple [ET_Atom "error"; ET_Atom "no_data"]
+    )
   | _ -> raise (Failure "Unknown command")
   ;;