Skip to content

Commit

Permalink
fix pack fromjson not doing error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Nov 15, 2024
1 parent 17c66f0 commit 2258944
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "4.0.0-alpha.1",
"version": "v1.6.4",
"version": "v1.6.5",
"gd": {
"win": "2.2074",
"android": "2.2074",
Expand Down
6 changes: 4 additions & 2 deletions src/Pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Pack::~Pack() {
Result<std::shared_ptr<Pack>> Pack::from(std::filesystem::path const& dir) {
#ifdef GEODE_IS_WINDOWS
try {
auto test = dir.filename().string();
(void) dir.filename().string();
} catch(const std::exception& e) {
return Err("Invalid path");
}
Expand All @@ -237,5 +237,7 @@ matjson::Value matjson::Serialize<std::shared_ptr<Pack>>::toJson(std::shared_ptr
}

Result<std::shared_ptr<Pack>> matjson::Serialize<std::shared_ptr<Pack>>::fromJson(matjson::Value const& value) {
return Ok(Pack::from(value["path"].as<std::filesystem::path>().unwrap()).unwrap());
GEODE_UNWRAP_INTO(auto path, value["path"].as<std::filesystem::path>());
GEODE_UNWRAP_INTO(auto pack, Pack::from(path));
return Ok(pack);
}

0 comments on commit 2258944

Please sign in to comment.