]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3440] Removed try catch block
authorFrancis Dupont <fdupont@isc.org>
Tue, 16 Jul 2024 07:58:11 +0000 (09:58 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 19 Jul 2024 15:49:52 +0000 (17:49 +0200)
src/lib/dhcp/libdhcp++.cc

index 87660b0515f9a6eedb02b4052e5f6b1e43ac7685..108d3cbfd3b02fb9c67cfac8132f29c5575f0456 100644 (file)
@@ -605,8 +605,9 @@ LibDHCP::unpackOptions4(const OptionBuffer& buf, const string& option_space,
         offset += opt_len;
 
         // Concatenate multiple instance of an option.
-        try {
-            size_t count = counts.at(opt_type);
+        
+        if (counts.count(opt_type) > 0) {
+            size_t count = counts[opt_type];
             OptionBuffer& previous = fused[opt_type];
             previous.insert(previous.end(), obuf.begin(), obuf.end());
             if (count <= 1) {
@@ -616,8 +617,6 @@ LibDHCP::unpackOptions4(const OptionBuffer& buf, const string& option_space,
                 counts[opt_type] = count - 1;
                 continue;
             }
-        } catch (const std::out_of_range&) {
-            // Regular case.
         }
 
         // Get all definitions with the particular option code. Note