From ee4bb488684ddd913edfcb4cc09a50d94bf8a1f0 Mon Sep 17 00:00:00 2001 From: meserve Date: Fri, 18 Nov 2016 16:50:36 -0600 Subject: device: change hashing test logic from try-throw-catch to if-else Allows to trigger on catches during debugging. Reviewed-By: Martin Braun --- host/lib/device.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/host/lib/device.cpp b/host/lib/device.cpp index ff4bbc212..c75ecad77 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -162,13 +162,11 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz static uhd::dict > hash_to_device; //try to find an existing device - try{ - UHD_ASSERT_THROW(hash_to_device.has_key(dev_hash)); - UHD_ASSERT_THROW(not hash_to_device[dev_hash].expired()); + if (hash_to_device.has_key(dev_hash) and not hash_to_device[dev_hash].expired()){ return hash_to_device[dev_hash].lock(); } - //create and register a new device - catch(const uhd::assertion_error &){ + else { + //create and register a new device device::sptr dev = maker(dev_addr); hash_to_device[dev_hash] = dev; return dev; -- cgit v1.2.3