summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'view/sharedcache/core/SharedCache.cpp')
-rw-r--r--view/sharedcache/core/SharedCache.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index a597cfb5..49aa3174 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -1333,6 +1333,12 @@ void SharedCache::ParseAndApplySlideInfoForFile(std::shared_ptr<MMappedFileAcces
SharedCache::SharedCache(BinaryNinja::Ref<BinaryNinja::BinaryView> dscView) : m_dscView(dscView)
{
+ if (dscView->GetTypeName() != VIEW_NAME)
+ {
+ // Unreachable?
+ m_logger->LogError("Attempted to create SharedCache object from non-Shared Cache view");
+ return;
+ }
sharedCacheReferences++;
INIT_SHAREDCACHE_API_OBJECT()
m_logger = LogRegistry::GetLogger("SharedCache", dscView->GetFile()->GetSessionId());
@@ -1381,6 +1387,8 @@ SharedCache::~SharedCache() {
SharedCache* SharedCache::GetFromDSCView(BinaryNinja::Ref<BinaryNinja::BinaryView> dscView)
{
+ if (dscView->GetTypeName() != VIEW_NAME)
+ return nullptr;
try {
return new SharedCache(dscView);
}