NetworkTable: Don't prefix path with / if key is empty.

This avoids NetworkTable("").putValue("foo") resulting in key "//foo".
This commit is contained in:
Peter Johnson
2015-08-28 12:24:33 -07:00
parent b28807d791
commit 9c576b10d0

View File

@@ -46,8 +46,10 @@ void NetworkTable::SetIPAddress(StringRef address) {
std::shared_ptr<NetworkTable> NetworkTable::GetTable(StringRef key) {
if (!s_running) Initialize();
llvm::SmallString<128> path;
path += PATH_SEPARATOR_CHAR;
path += key;
if (!key.empty()) {
path += PATH_SEPARATOR_CHAR;
path += key;
}
return std::make_shared<NetworkTable>(path, private_init());
}