From 43a31623c7e9290ec4917ac54cd547c0bb639827 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Thu, 20 Jun 2024 12:17:19 -0400 Subject: [PATCH] fix magic current_raw_offset when no BV open --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 70ba813..d880cad 100644 --- a/__init__.py +++ b/__init__.py @@ -259,7 +259,7 @@ def run(self): self.context.binaryView.file.navigate(self.context.binaryView.file.view, snippetGlobals['here']) if "current_address" in snippetGlobals and hasattr(self.context, "address") and snippetGlobals['current_address'] != self.context.address: self.context.binaryView.file.navigate(self.context.binaryView.file.view, snippetGlobals['current_address']) - if "current_raw_offset" in snippetGlobals and hasattr(self.context, "address") and snippetGlobals['current_raw_offset'] != self.context.binaryView.get_data_offset_for_address(self.context.address): + if self.context.binaryView is not None and "current_raw_offset" in snippetGlobals and hasattr(self.context, "address") and snippetGlobals['current_raw_offset'] != self.context.binaryView.get_data_offset_for_address(self.context.address): addr = self.context.binaryView.get_address_for_data_offset(snippetGlobals["current_raw_offset"]) if addr is not None: if not self.context.binaryView.file.navigate(self.context.binaryView.file.view, addr):