From 7fb8b5e1ed94900f4d75d5a19e84f8e511a03156 Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Fri, 29 Mar 2019 15:47:34 +0100 Subject: [PATCH] [#490,!293] Do not throw from the getHostReservationMode function. --- src/lib/dhcpsrv/network.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib/dhcpsrv/network.h b/src/lib/dhcpsrv/network.h index 91611b9f91..ca45da023f 100644 --- a/src/lib/dhcpsrv/network.h +++ b/src/lib/dhcpsrv/network.h @@ -405,9 +405,18 @@ public: util::Optional hr_mode_name; hr_mode_name = getGlobalProperty(hr_mode_name, "reservation-mode"); if (!hr_mode_name.unspecified()) { - // If the HR mode is globally configured, let's convert it from - // a string to enum. - return (hrModeFromString(hr_mode_name.get())); + try { + // If the HR mode is globally configured, let's convert it from + // a string to enum. + return (hrModeFromString(hr_mode_name.get())); + + } catch (...) { + // This should not really happen because the configuration + // parser should have already verified the globally configured + // reservation mode. However, we want to be 100% sure that this + // method doesn't throw. Let's just return unspecified. + return (hr_mode); + } } } return (hr_mode); -- 2.47.2