don't call .front() on an empty vector
authorEvan Martin <martine@danga.com>
Sun, 17 Feb 2013 21:19:53 +0000 (13:19 -0800)
committerEvan Martin <martine@danga.com>
Mon, 8 Apr 2013 22:02:29 +0000 (15:02 -0700)
Fixes a gcc debug-mode assertion.

src/deps_log.cc

index 78eb23f..454d2e5 100644 (file)
@@ -55,7 +55,8 @@ bool DepsLog::OpenForWrite(const string& path, string* err) {
 
 bool DepsLog::RecordDeps(Node* node, TimeStamp mtime,
                          const vector<Node*>& nodes) {
-  return RecordDeps(node, mtime, nodes.size(), (Node**)&nodes.front());
+  return RecordDeps(node, mtime, nodes.size(),
+                    nodes.empty() ? NULL : (Node**)&nodes.front());
 }
 
 bool DepsLog::RecordDeps(Node* node, TimeStamp mtime,