summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm24
1 files changed, 19 insertions, 5 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index a0b5122548f..014564331c0 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -585,17 +585,25 @@ sub register_extension {
my $file_type = shift;
debug("Linking $extension to $file_type\n");
- my ($classes_key, $k);
+ my ($classes_key_path, $classes_key, $k);
$extension = lc($extension);
if ($is_admin) {
- $classes_key = $Registry -> Open("LMachine/Software/Classes/",
- {Access => KEY_ALL_ACCESS()}) or die "Cannot open classpath";
+ $classes_key_path = "LMachine/Software/Classes/";
} else {
- $classes_key = $Registry -> Open("CUser/Software/Classes/",
- {Access => KEY_ALL_ACCESS()});
+ $classes_key_path = "CUser/Software/Classes/";
}
+ $classes_key = $Registry -> Open($classes_key_path,
+ {Access => KEY_ALL_ACCESS()});
+
+ if (!defined($classes_key)) {
+ tlwarn("Cannot get key to $classes_key\n" .
+ "Cannot continue setting up associations.\n");
+ # should we die here in the admin case?
+ # so it was before, but that is probably not the best idea
+ return;
+ }
my $do_create_key = 0;
@@ -604,6 +612,8 @@ sub register_extension {
if (defined($classes_key->{$extension}->{'/'})) {
if ($classes_key->{$extension}->{'/'} eq $file_type) {
debug("register_extension: already same key $extension $file_type present, recreate it\n");
+ # delete it so that it is recreated ...
+ delete $classes_key -> {$extension};
$do_create_key = 1;
} else {
debug("register_extension: old foreign key" . $classes_key->{$extension}->{'/'} . " found, not changing\n");
@@ -621,6 +631,10 @@ sub register_extension {
if ($do_create_key) {
$k = $classes_key->CreateKey($extension);
+ if (!defined($k)) {
+ tlwarn("Cannot create key for $extension in $classes_key_path.\n");
+ return;
+ }
$k -> ArrayValues(0);
$k -> {"/"} = $file_type;
if (admin()) {