summaryrefslogtreecommitdiffstats
path: root/src/util.cc
diff options
context:
space:
mode:
authorPeter Kuemmel <syntheticpp@gmx.net>2012-01-23 21:24:55 (GMT)
committerPeter Kuemmel <syntheticpp@gmx.net>2012-01-23 21:24:55 (GMT)
commit62e9139740950c9a9bf1397922691e956b629f2f (patch)
tree8b6f49e1a2cf042f80f09cf662f2286b2b4e0b6c /src/util.cc
parent133cba3f664b82be9dbeeff151f7cfb4b1065242 (diff)
downloadNinja-62e9139740950c9a9bf1397922691e956b629f2f.zip
Ninja-62e9139740950c9a9bf1397922691e956b629f2f.tar.gz
Ninja-62e9139740950c9a9bf1397922691e956b629f2f.tar.bz2
check access to first element of string: string could be empty
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/util.cc b/src/util.cc
index 9f538b9..1dd9838 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -79,7 +79,10 @@ void Error(const char* msg, ...) {
bool CanonicalizePath(string* path, string* err) {
METRIC_RECORD("canonicalize str");
int len = path->size();
- if (!CanonicalizePath(&(*path)[0], &len, err))
+ char* str = 0;
+ if (len > 0)
+ str = &(*path)[0];
+ if (!CanonicalizePath(str, &len, err))
return false;
path->resize(len);
return true;