]> matita.cs.unibo.it Git - helm.git/commitdiff
handle Not_found exception in extension
authorStefano Zacchiroli <zack@upsilon.cc>
Tue, 5 Jul 2005 05:57:02 +0000 (05:57 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Tue, 5 Jul 2005 05:57:02 +0000 (05:57 +0000)
helm/ocaml/getter/http_getter_misc.ml

index 4149d4603154337986c3f6d0c54f2db9ec68501c..0430c1b48d3cf96856499f9e3fe418c801cc022a 100644 (file)
@@ -289,6 +289,8 @@ let rec list_uniq = function
   | h1::tl (* when h1 <> h2 *) -> h1 :: list_uniq tl
 
 let extension s =
-  let idx = String.rindex s '.' in
-  String.sub s idx (String.length s - idx)
+  try
+    let idx = String.rindex s '.' in
+    String.sub s idx (String.length s - idx)
+  with Not_found -> ""