Skip to content

Commit

Permalink
check if citationJson has member "type" and "id"
Browse files Browse the repository at this point in the history
  • Loading branch information
a1henu committed May 1, 2024
1 parent a100ec3 commit 06d99d7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ std::unordered_map<std::string, CitationPtr> loadCitations(const std::string& fi
}

for (auto& item : data) {
if (!item.contains("type") || !item.contains("id")) {
std::exit(1);
}
std::string type = item["type"].get<std::string>();
std::string id = item["id"].get<std::string>();
if (type == "book") {
Expand Down

0 comments on commit 06d99d7

Please sign in to comment.