diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-05-17 14:43:12 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-05-17 17:25:43 -0700 |
commit | 3964021e9781be74db932c3ceacbb40a93c12287 (patch) | |
tree | 63a656ce737f001e4d685192eb4eeffa197de2f8 /host/lib/usrp/multi_usrp.cpp | |
parent | 174bde6cc17c901b116c99fea8f1888c96f7823b (diff) | |
download | uhd-3964021e9781be74db932c3ceacbb40a93c12287.tar.gz uhd-3964021e9781be74db932c3ceacbb40a93c12287.tar.bz2 uhd-3964021e9781be74db932c3ceacbb40a93c12287.zip |
multi_usrp: Check for existence of mboard sensor names
get_mboard_sensor_names() would crash if a USRP didn't actually have at
least one sensors defined.
Diffstat (limited to 'host/lib/usrp/multi_usrp.cpp')
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 9b61344ef..cdce43055 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -803,7 +803,10 @@ public: } std::vector<std::string> get_mboard_sensor_names(size_t mboard){ - return _tree->list(mb_root(mboard) / "sensors"); + if (_tree->exists(mb_root(mboard) / "sensors")) { + return _tree->list(mb_root(mboard) / "sensors"); + } + return {}; } void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard){ |