Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion saphyr/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ absl::StatusOr<Node> Load(rs_std::StrRef input) {
StringViewFromVecU8(std::move(result).err()));
}
rust::NodeOwned docs = std::move(result).value();
return Node(docs.get_at_index(0)->to_owned());
std::optional<rust::NodeView> first_doc = docs.get_at_index(0);
if (!first_doc.has_value()) {
return absl::InvalidArgumentError("Empty YAML document");
}
return Node(first_doc->to_owned());
}

rust::YamlOwned ToYaml(int64_t value) {
Expand Down
Loading