From: Neale Ranns Date: Sat, 25 Nov 2017 10:52:06 +0000 (-0800) Subject: VOM: handle null for iterator in dump cmd X-Git-Tag: v18.04-rc0~180 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F67%2F9567%2F2;p=vpp.git VOM: handle null for iterator in dump cmd Change-Id: I2e8743d70a8d8604d370218a73d5f37c2f7c4617 Signed-off-by: Neale Ranns --- diff --git a/src/vpp-api/vom/dump_cmd.hpp b/src/vpp-api/vom/dump_cmd.hpp index cc255ac0daf..72fcdf55746 100644 --- a/src/vpp-api/vom/dump_cmd.hpp +++ b/src/vpp-api/vom/dump_cmd.hpp @@ -62,9 +62,28 @@ public: */ virtual ~dump_cmd() {} - const_iterator begin() { return (m_dump->get_result_set().begin()); } + /** + * Constant iterator to the start of the records retunred during the dump + */ + const_iterator begin() + { + /* + * m_dump is NULL during client UT when the commands are not issued. + */ + if (!m_dump) + return const_iterator(); + return (m_dump->get_result_set().begin()); + } - const_iterator end() { return (m_dump->get_result_set().end()); } + /** + * Constant iterator to the end of the records retunred during the dump + */ + const_iterator end() + { + if (!m_dump) + return const_iterator(); + return (m_dump->get_result_set().end()); + } /** * Wait for the issue of the command to complete