Permalink
Browse files

[fix] objectFiles.ml: defensive fix against List.extract_all failure

  • Loading branch information...
1 parent 63dcc99 commit 2c64387a5e2d23107c3a69b2b0cf1273f5d47fb0 @OpaOnWindowsNow OpaOnWindowsNow committed Mar 26, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 compilerlib/objectFiles.ml
@@ -1810,10 +1810,18 @@ let add_compiler_packages packs =
let unique l = List.uniq_unsorted ~cmp:Package.compare l in
package_names := unique (!package_names @ packs);
package_deep_names := unique (!package_deep_names @ deeps @ packs);
- let (h,t) = List.extract_last !package_deep_names_and_more_deeps_names in
- package_deep_names_and_more_deeps_names := (unique (h @ deeps @ packs @ [t]));
- let (h,t) = List.extract_last !package_names_and_more_names in
- package_names_and_more_names := (unique (h @ deeps @ packs @ [t]));
+ (if !package_deep_names_and_more_deeps_names <> [] then (
+ let (h,t) = List.extract_last !package_deep_names_and_more_deeps_names in
+ package_deep_names_and_more_deeps_names := unique (h @ deeps @ packs @ [t])
+ ) else (
+ package_deep_names_and_more_deeps_names := unique (!package_deep_names_and_more_deeps_names @ deeps @ packs)
+ ));
+ if !package_names_and_more_names <> [] then (
+ let (h,t) = List.extract_last !package_names_and_more_names in
+ package_names_and_more_names := unique (h @ deeps @ packs @ [t])
+ ) else (
+ package_names_and_more_names := unique (!package_names_and_more_names @ deeps @ packs )
+ );
compare_packages_update !package_deep_names_and_more_deeps_names;;
let resave () =

0 comments on commit 2c64387

Please sign in to comment.