summaryrefslogtreecommitdiff
path: root/collaboration.cpp
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-09-25 15:23:58 -0400
committerJosh Ferrell <josh@vector35.com>2024-09-25 17:11:36 -0400
commit3e5ecf7a6d7ed6996eb62a8cfb4849e7556cec99 (patch)
tree9144b77536503a338cb6dafdea1bb13a60402396 /collaboration.cpp
parent6f19d94cf12146f381caab59618d8ba8a4a992b1 (diff)
Fix bad any cast on mac
Diffstat (limited to 'collaboration.cpp')
-rw-r--r--collaboration.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/collaboration.cpp b/collaboration.cpp
index f3bb242e..f154865a 100644
--- a/collaboration.cpp
+++ b/collaboration.cpp
@@ -2221,18 +2221,13 @@ std::string AnalysisMergeConflict::GetPathItem<std::string>(const std::string& p
template <>
nlohmann::json AnalysisMergeConflict::GetPathItem<nlohmann::json>(const std::string& path)
{
- std::any anyVal = GetPathItem<std::any>(path);
- try
- {
- return std::any_cast<nlohmann::json>(anyVal);
- }
- catch (const std::exception& e)
- {
- throw SyncException(fmt::format(
- "Failed to cast merge conflict path item \"{}\" from \"{}\" to \"{}\": {}",
- path, anyVal.type().name(), typeid(nlohmann::json).name(), e.what()
- ));
- }
+ char* val = BNAnalysisMergeConflictGetPathItemSerialized(m_object, path.c_str());
+ if (val == nullptr)
+ throw SyncException(fmt::format("Failed to find merge conflict path item \"{}\"", path));
+
+ std::string strVal = val;
+ BNFreeString(val);
+ return nlohmann::json::parse(strVal);
}