From: Sam H. v. a. <we...@ma...> - 2005-10-26 16:41:42
|
Log Message: ----------- possible fix for problem when status_abbrev_has_behavior is used with an abbrev that doesn't map to any status. Modified Files: -------------- webwork2/lib/WeBWorK: CourseEnvironment.pm Revision Data ------------- Index: CourseEnvironment.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/CourseEnvironment.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -Llib/WeBWorK/CourseEnvironment.pm -Llib/WeBWorK/CourseEnvironment.pm -u -r1.31 -r1.32 --- lib/WeBWorK/CourseEnvironment.pm +++ lib/WeBWorK/CourseEnvironment.pm @@ -314,7 +314,12 @@ carp "status_abbrev_has_behavior: behavior (second argument) must be defined and non-empty" if not defined $behavior or $behavior eq ""; - return $ce->status_has_behavior($ce->status_abbrev_to_name($status_abbrev), $behavior); + my $status_name = $ce->status_abbrev_to_name($status_abbrev); + if (defined $status_name) { + return $ce->status_has_behavior($status_name, $behavior); + } else { + carp "status abbreviation '$status_abbrev' not found in \%statuses -- assuming no behaviors.\n"; + } } =back |