Skip to content

Commit 2258944

Browse files
committed
fix pack fromjson not doing error handling
1 parent 17c66f0 commit 2258944

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "4.0.0-alpha.1",
3-
"version": "v1.6.4",
3+
"version": "v1.6.5",
44
"gd": {
55
"win": "2.2074",
66
"android": "2.2074",

src/Pack.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Pack::~Pack() {
215215
Result<std::shared_ptr<Pack>> Pack::from(std::filesystem::path const& dir) {
216216
#ifdef GEODE_IS_WINDOWS
217217
try {
218-
auto test = dir.filename().string();
218+
(void) dir.filename().string();
219219
} catch(const std::exception& e) {
220220
return Err("Invalid path");
221221
}
@@ -237,5 +237,7 @@ matjson::Value matjson::Serialize<std::shared_ptr<Pack>>::toJson(std::shared_ptr
237237
}
238238

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

0 commit comments

Comments
 (0)