From: Tomek Mrugalski Date: Wed, 14 Aug 2019 08:12:28 +0000 (+0200) Subject: [#150,!385] Addressed review comments: X-Git-Tag: Kea-1.6.0~41^2~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70bb412f20b706484538680906d6fcfd7ee6da68;p=thirdparty%2Fkea.git [#150,!385] Addressed review comments: - extra checks for parent pointer - comments corrected --- diff --git a/src/lib/eval/tests/token_unittest.cc b/src/lib/eval/tests/token_unittest.cc index a038ee7c9b..0852e3f3d2 100644 --- a/src/lib/eval/tests/token_unittest.cc +++ b/src/lib/eval/tests/token_unittest.cc @@ -2984,7 +2984,7 @@ TEST_F(TokenTest, subOptionNoOption) { // we should have one value on the stack ASSERT_EQ(1, values_.size()); - // The option should NOT be found (there is option 82), + // The option should NOT be found (there is no option 82), // so the expression should evaluate to "" EXPECT_EQ("", values_.top()); diff --git a/src/lib/eval/token.cc b/src/lib/eval/token.cc index 482a9cd597..ab42ac0dfe 100644 --- a/src/lib/eval/token.cc +++ b/src/lib/eval/token.cc @@ -988,6 +988,9 @@ TokenInteger::TokenInteger(const uint32_t value) OptionPtr TokenSubOption::getSubOption(const OptionPtr& parent) { + if (!parent) { + return (OptionPtr()); + } return (parent->getOption(sub_option_code_)); } diff --git a/src/lib/eval/token.h b/src/lib/eval/token.h index 8275f98da1..d233973198 100644 --- a/src/lib/eval/token.h +++ b/src/lib/eval/token.h @@ -1060,7 +1060,7 @@ protected: /// @brief Token that represents sub-options in DHCPv4 and DHCPv6. /// /// It covers any options which encapsulate sub-options, for instance -/// dhcp-agent-options (72, DHCPv4) or rsoo (66, DHCPv6). +/// dhcp-agent-options (82, DHCPv4) or rsoo (66, DHCPv6). /// This class is derived from TokenOption and leverages its ability /// to operate on sub-options. It also adds additional capabilities. ///