getTable(): Don't prepend slash if key already starts with it.

This makes getTable("/foo") and getTable("foo") equivalent.
This commit is contained in:
Peter Johnson
2016-01-14 21:38:04 -08:00
parent 9092b74f4e
commit c90a8c586f
3 changed files with 13 additions and 4 deletions

View File

@@ -174,7 +174,7 @@ public class NetworkTable implements ITable, IRemote {
public synchronized static NetworkTable getTable(String key) {
if (!running)
initialize();
if (key.isEmpty())
if (key.isEmpty() || key.charAt(0) == PATH_SEPARATOR)
return new NetworkTable(key);
return new NetworkTable(PATH_SEPARATOR + key);
}