diff options
| author | Glenn Smith <glenn@vector35.com> | 2022-07-19 18:27:50 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2022-09-29 21:02:24 -0400 |
| commit | 0725c6fbd58b3d40ffefdb319121a29ba4168517 (patch) | |
| tree | 43321b54b45dd16154bc104886b5e3ef08017b75 /debuginfo.cpp | |
| parent | 460656be13999759eb1eeb5bd9a868b34c0aea22 (diff) | |
Make DebugInfo::parse failable
Diffstat (limited to 'debuginfo.cpp')
| -rw-r--r-- | debuginfo.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/debuginfo.cpp b/debuginfo.cpp index fb10039e..c67582cb 100644 --- a/debuginfo.cpp +++ b/debuginfo.cpp @@ -363,10 +363,21 @@ string DebugInfoParser::GetName() const Ref<DebugInfo> DebugInfoParser::Parse(Ref<BinaryView> view, Ref<DebugInfo> existingDebugInfo) const { + BNDebugInfo* info = nullptr; if (existingDebugInfo) - return new DebugInfo( - BNNewDebugInfoReference(BNParseDebugInfo(m_object, view->GetObject(), existingDebugInfo->GetObject()))); - return new DebugInfo(BNParseDebugInfo(m_object, view->GetObject(), nullptr)); + { + info = BNParseDebugInfo(m_object, view->GetObject(), existingDebugInfo->GetObject()); + if (!info) + return nullptr; + info = BNNewDebugInfoReference(info); + } + else + { + info = BNParseDebugInfo(m_object, view->GetObject(), nullptr); + if (!info) + return nullptr; + } + return new DebugInfo(info); } @@ -388,10 +399,10 @@ bool CustomDebugInfoParser::IsValidCallback(void* ctxt, BNBinaryView* view) } -void CustomDebugInfoParser::ParseCallback(void* ctxt, BNDebugInfo* debugInfo, BNBinaryView* view) +bool CustomDebugInfoParser::ParseCallback(void* ctxt, BNDebugInfo* debugInfo, BNBinaryView* view) { CustomDebugInfoParser* parser = (CustomDebugInfoParser*)ctxt; - parser->ParseInfo(new DebugInfo(debugInfo), new BinaryView(view)); + return parser->ParseInfo(new DebugInfo(debugInfo), new BinaryView(view)); } |
