never crash

This commit is contained in:
Mylloon 2023-10-24 15:46:53 +02:00
parent abcbd1754c
commit 24860a540f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -31,12 +31,12 @@
| "\\\"" -> Some '"'
| "\\\\" -> Some '\\'
| _ ->
(match String.get data 1 with
| '0' | '1' | '2' ->
let caractere = String.sub data 1 (String.length data - 1) in
let ascii_code = int_of_string caractere in
Some (Char.chr ascii_code)
| _ -> None)
(try
let caractere = String.sub data 1 (String.length data - 1) in
let ascii_code = int_of_string caractere in
Some (Char.chr ascii_code)
with
| _ -> None)
;;
}