summaryrefslogtreecommitdiff
path: root/transformsession.cpp
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-11-07 16:43:22 -0500
committerBrian Potchik <brian@vector35.com>2025-11-07 16:43:22 -0500
commit457928217ef7c2ea36aa20346df4e0790044ae35 (patch)
tree90b92e488d274018a4b755a225ebcebd7541cfb7 /transformsession.cpp
parent8c09e77cb661c991ed1c76ef9809ee7ea0579807 (diff)
Fix crash when attempting to open an invalid file.
Diffstat (limited to 'transformsession.cpp')
-rw-r--r--transformsession.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/transformsession.cpp b/transformsession.cpp
index 9cf5cf3b..14aabcea 100644
--- a/transformsession.cpp
+++ b/transformsession.cpp
@@ -41,19 +41,28 @@ TransformSession::~TransformSession()
Ref<BinaryView> TransformSession::GetCurrentView() const
{
- return new BinaryView(BNTransformSessionGetCurrentView(m_object));
+ BNBinaryView* view = BNTransformSessionGetCurrentView(m_object);
+ if (!view)
+ return nullptr;
+ return new BinaryView(view);
}
Ref<TransformContext> TransformSession::GetRootContext() const
{
- return new TransformContext(BNTransformSessionGetRootContext(m_object));
+ BNTransformContext* context = BNTransformSessionGetRootContext(m_object);
+ if (!context)
+ return nullptr;
+ return new TransformContext(context);
}
Ref<TransformContext> TransformSession::GetCurrentContext() const
{
- return new TransformContext(BNTransformSessionGetCurrentContext(m_object));
+ BNTransformContext* context = BNTransformSessionGetCurrentContext(m_object);
+ if (!context)
+ return nullptr;
+ return new TransformContext(context);
}