Index: native_client_sdk/src/libraries/nacl_io/path.cc |
diff --git a/native_client_sdk/src/libraries/nacl_io/path.cc b/native_client_sdk/src/libraries/nacl_io/path.cc |
index 0a64a15ebce411f35d83c3bcc2fe1da7bd5cd72d..ae16b26a445016c7da43ab0a0b489143dc665ab8 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/path.cc |
+++ b/native_client_sdk/src/libraries/nacl_io/path.cc |
@@ -44,6 +44,8 @@ bool Path::Top() const { |
Path& Path::Append(const std::string& path) { |
StringArray_t paths = Split(path); |
+ if (paths.size() == 0) |
binji
2014/06/09 20:54:29
I prefer paths.empty() for this, but it looks like
Sam Clegg
2014/06/10 17:20:59
Done.
|
+ return *this; |
for (size_t index = 0; index < paths.size(); index++) { |
// Skip ROOT |
@@ -58,13 +60,16 @@ Path& Path::Append(const std::string& path) { |
Path& Path::Prepend(const std::string& path) { |
StringArray_t paths = Split(path); |
+ if (paths.size() == 0) |
+ return *this; |
for (size_t index = 0; index < paths_.size(); index++) { |
// Skip ROOT |
if (index == 0 && paths_[0] == "/") |
continue; |
- paths.push_back(paths[index]); |
+ paths.push_back(paths_[index]); |
binji
2014/06/09 20:54:29
why? If needed, be consistent with same in Path::A
Sam Clegg
2014/06/10 17:20:59
This is simply a bug.
Append is pushing all the p
binji
2014/06/10 18:00:58
I see.
|
} |
+ |
paths_ = Normalize(paths); |
return *this; |
} |