From: Amos Jeffries Date: Wed, 15 Jan 2014 01:59:19 +0000 (+1300) Subject: Cleanup: Improve testACLMaxUserIP NULL checks X-Git-Tag: SQUID_3_5_0_1~412 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc6180e7f44ed17682b427cb2d5d33040c669a98;p=thirdparty%2Fsquid.git Cleanup: Improve testACLMaxUserIP NULL checks Detected by Coverity Scan. Issue 1140358. --- diff --git a/src/tests/testACLMaxUserIP.cc b/src/tests/testACLMaxUserIP.cc index ed9fe7529c..542aa5c813 100644 --- a/src/tests/testACLMaxUserIP.cc +++ b/src/tests/testACLMaxUserIP.cc @@ -41,12 +41,13 @@ testACLMaxUserIP::testParseLine() ACL::ParseAclLine(LegacyParser, &anACL); ACLMaxUserIP *maxUserIpACL = dynamic_cast(anACL); CPPUNIT_ASSERT(maxUserIpACL); - - /* we want a maximum of one, and strict to be true */ - CPPUNIT_ASSERT_EQUAL(1, maxUserIpACL->getMaximum()); - CPPUNIT_ASSERT_EQUAL(true, maxUserIpACL->getStrict()); - /* the acl must be vaid */ - CPPUNIT_ASSERT_EQUAL(true, maxUserIpACL->valid()); + if (maxUserIpACL) { + /* we want a maximum of one, and strict to be true */ + CPPUNIT_ASSERT_EQUAL(1, maxUserIpACL->getMaximum()); + CPPUNIT_ASSERT_EQUAL(true, maxUserIpACL->getStrict()); + /* the acl must be vaid */ + CPPUNIT_ASSERT_EQUAL(true, maxUserIpACL->valid()); + } delete anACL; xfree(line); }