Skip to content

Commit

Permalink
set unit name empty string and nullptr handling fixed (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky authored and FlorianReimold committed Mar 6, 2024
1 parent 5a9aad3 commit b2324e7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ecal/core/src/ecal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,17 @@ namespace eCAL
*
* @param unit_name_ Defines the name of the eCAL unit.
*
* @return Zero if succeeded.
* @return Zero if succeeded, -1 if failed.
**/
int SetUnitName(const char *unit_name_)
{
g_unit_name = unit_name_;
return(0);
if (unit_name_ == nullptr) return -1;

const std::string uname = unit_name_;
if (uname.empty()) return -1;

g_unit_name = uname;
return 0;
}

/**
Expand Down

0 comments on commit b2324e7

Please sign in to comment.