Skip to content

Commit

Permalink
[MirrorOrch]: Fix bug when NULL is returned from the getenv function (s…
Browse files Browse the repository at this point in the history
…onic-net#537)

This fixes the error:
Failed due to exception: basic_string::_S_construct null not valid

when the environment variable 'platform' is not set.

Signed-off-by: Shu0T1an ChenG <[email protected]>
  • Loading branch information
Shuotian Cheng authored and lguohan committed Jul 13, 2018
1 parent 762e7da commit b976487
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion orchagent/mirrororch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ void MirrorOrch::createEntry(const string& key, const vector<FieldValueTuple>& d
{
SWSS_LOG_ENTER();

MirrorEntry entry(getenv("platform"));
string platform = getenv("platform") ? getenv("platform") : "";
MirrorEntry entry(platform);

for (auto i : data)
{
Expand Down

0 comments on commit b976487

Please sign in to comment.