X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2FmatitaGtkMisc.ml;h=6407ae35d1e8654fb89022b574704f50fea84422;hb=d2a9e9b78b214663fb0e21eed95b21c5ab7119c6;hp=c397215a790d20e78510d5eb80b26cb3543bc7cf;hpb=358720b93255d1aa526dc03c63a5d6193658b93b;p=helm.git diff --git a/matita/matitaGtkMisc.ml b/matita/matitaGtkMisc.ml index c397215a7..6407ae35d 100644 --- a/matita/matitaGtkMisc.ml +++ b/matita/matitaGtkMisc.ml @@ -443,8 +443,14 @@ let utf8_parsed_text s floc = let start, stop = HExtlib.loc_of_floc floc in let start_bytes = Glib.Utf8.offset_to_pos s ~pos:0 ~off:start in let stop_bytes = Glib.Utf8.offset_to_pos s ~pos:0 ~off:stop in + assert(stop_bytes >= start_bytes); let bytes = stop_bytes - start_bytes in - String.sub s start_bytes bytes, bytes + try + String.sub s start_bytes bytes, bytes + with Invalid_argument _ -> + Printf.eprintf "%s/%d/%d\n" s start_bytes bytes; + assert false + let utf8_string_length s = if BuildTimeConf.debug then