From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 21 Jun 2008 16:46:41 +0000 (+0000)
Subject: In check_status_code_result(), make sure
X-Git-Tag: v_3_0_9~18
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/faq/%22https:/developer-manual/static/gitweb.js?a=commitdiff_plain;h=a1656f702b2ed3a07ca3c189a895a393611791bc;p=privoxy.git

In check_status_code_result(), make sure
$status_code is defined before checking it.
---

diff --git a/tools/privoxy-regression-test.pl b/tools/privoxy-regression-test.pl
index 21f0e215..ea9d78ca 100755
--- a/tools/privoxy-regression-test.pl
+++ b/tools/privoxy-regression-test.pl
@@ -7,7 +7,7 @@
 # A regression test "framework" for Privoxy. For documentation see:
 # perldoc privoxy-regression-test.pl
 #
-# $Id: privoxy-regression-test.pl,v 1.153 2008/05/25 18:48:07 fk Exp $
+# $Id: privoxy-regression-test.pl,v 1.154 2008/06/21 16:44:09 fk Exp $
 #
 # Wish list:
 #
@@ -741,7 +741,13 @@ sub check_status_code_result ($$) {
     my $expected_status_code = shift;
     my $result = 0;
 
-    if ($expected_status_code == $status_code) {
+    unless (defined $status_code) {
+
+        # XXX: should probably be caught earlier.
+        l(LL_VERBOSE_FAILURE,
+          "Ooops. We expected status code " . $expected_status_code . ", but didn't get any status code at all.");
+
+    } elsif ($expected_status_code == $status_code) {
 
         $result = 1;
         l(LL_VERBOSE_SUCCESS,