summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sim/system.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 911ee5d9b..74bc94ee8 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -538,10 +538,13 @@ System::_getMasterId(const SimObject* master, std::string master_name)
std::string
System::leafMasterName(const SimObject* master, const std::string& submaster)
{
- // Get the full master name by appending the submaster name to
- // the root SimObject master name
- auto master_name = master->name() + "." + submaster;
- return master_name;
+ if (submaster.empty()) {
+ return master->name();
+ } else {
+ // Get the full master name by appending the submaster name to
+ // the root SimObject master name
+ return master->name() + "." + submaster;
+ }
}
std::string