From 457928217ef7c2ea36aa20346df4e0790044ae35 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Fri, 7 Nov 2025 16:43:22 -0500 Subject: Fix crash when attempting to open an invalid file. --- transformsession.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'transformsession.cpp') 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 TransformSession::GetCurrentView() const { - return new BinaryView(BNTransformSessionGetCurrentView(m_object)); + BNBinaryView* view = BNTransformSessionGetCurrentView(m_object); + if (!view) + return nullptr; + return new BinaryView(view); } Ref TransformSession::GetRootContext() const { - return new TransformContext(BNTransformSessionGetRootContext(m_object)); + BNTransformContext* context = BNTransformSessionGetRootContext(m_object); + if (!context) + return nullptr; + return new TransformContext(context); } Ref TransformSession::GetCurrentContext() const { - return new TransformContext(BNTransformSessionGetCurrentContext(m_object)); + BNTransformContext* context = BNTransformSessionGetCurrentContext(m_object); + if (!context) + return nullptr; + return new TransformContext(context); } -- cgit v1.3.1