From 5ceebf3406f9e57434655b18db8b0bcf9b981f15 Mon Sep 17 00:00:00 2001 From: Ryan Snyder Date: Thu, 21 Jun 2018 20:39:33 -0400 Subject: c++: Allow custom BinaryViewTypes to fail gracefully --- binaryviewtype.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'binaryviewtype.cpp') diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp index e8ef4f53..233fdb87 100644 --- a/binaryviewtype.cpp +++ b/binaryviewtype.cpp @@ -29,6 +29,8 @@ BNBinaryView* BinaryViewType::CreateCallback(void* ctxt, BNBinaryView* data) BinaryViewType* type = (BinaryViewType*)ctxt; Ref view = new BinaryView(BNNewViewReference(data)); Ref result = type->Create(view); + if (result == nullptr) + return nullptr; return BNNewViewReference(result->GetObject()); } -- cgit v1.3.1