We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11d8176 commit 61baa05Copy full SHA for 61baa05
1 file changed
lib/importproject.cpp
@@ -359,6 +359,17 @@ bool ImportProject::importCompileCommands(std::istream &istr)
359
360
for (const picojson::value &fileInfo : compileCommands.get<picojson::array>()) {
361
picojson::object obj = fileInfo.get<picojson::object>();
362
+
363
+ if (obj.count("directory") == 0) {
364
+ printError("'directory' field in compilation database entry missing");
365
+ return false;
366
+ }
367
368
+ if (!obj["directory"].is<std::string>()) {
369
+ printError("'directory' field in compilation database entry is not a string");
370
371
372
373
std::string dirpath = Path::fromNativeSeparators(obj["directory"].get<std::string>());
374
375
/* CMAKE produces the directory without trailing / so add it if not
0 commit comments