From a5fdb76bc393bd943a8505e14bf31919e4a1689d Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Sat, 13 Apr 2024 16:37:28 -0700 Subject: [PATCH] define set_to_display as empty string when undefined --- lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm b/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm index e15b2dff18..b5901a72bb 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm @@ -534,9 +534,9 @@ sub pre_header_initialize ($c) { } } elsif ($c->param('view_course_set')) { # View problems selected from the a set in this course - my $set_to_display = $c->{current_library_set}; + my $set_to_display = $c->{current_library_set} // ''; debug("set_to_display is $set_to_display"); - if (!defined $set_to_display || $set_to_display eq '') { + if ($set_to_display eq '') { $c->addbadmessage($c->maketext("You need to select a set from this course to view.")); } else { @pg_files = map { { 'filepath' => $_->source_file, 'morelt' => 0 } } @@ -549,9 +549,9 @@ sub pre_header_initialize ($c) { $use_previous_problems = 0; } elsif ($c->param('view_setdef_set')) { # View a set from a set*.def - my $set_to_display = $c->{current_library_set}; + my $set_to_display = $c->{current_library_set} // ''; debug("set_to_display is $set_to_display"); - if (!defined $set_to_display || $set_to_display eq '') { + if ($set_to_display eq '') { $c->addbadmessage($c->maketext("You need to select a set definition file to view.")); } else { @pg_files = $c->read_set_def($set_to_display);