summaryrefslogtreecommitdiff
path: root/examples/triage/fileinfo.cpp
diff options
context:
space:
mode:
authorrose <47357290+rompse@users.noreply.github.com>2021-10-08 16:50:52 -0400
committerrose <47357290+rompse@users.noreply.github.com>2021-10-08 16:50:52 -0400
commit38fafa6e1dc5b5aade628b01a61d97f687e1a047 (patch)
tree2c643cf616d2f91b80fc92473a286f6e991bdbaf /examples/triage/fileinfo.cpp
parent76a28b792c26d8bf3221d807d30bc09ff71249c1 (diff)
Fix TriageView crash
Diffstat (limited to 'examples/triage/fileinfo.cpp')
-rw-r--r--examples/triage/fileinfo.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/triage/fileinfo.cpp b/examples/triage/fileinfo.cpp
index 00b75ca2..2ff7cf38 100644
--- a/examples/triage/fileinfo.cpp
+++ b/examples/triage/fileinfo.cpp
@@ -76,15 +76,16 @@ FileInfoWidget::FileInfoWidget(QWidget* parent, BinaryViewRef bv)
this->m_layout->setContentsMargins(0, 0, 0, 0);
this->m_layout->setVerticalSpacing(1);
+ const auto view = bv->GetParentView() ? bv->GetParentView() : bv;
const auto filePath = bv->GetFile()->GetOriginalFilename();
this->addField("Path: ", filePath.c_str());
- const auto fileSize = QString::number(bv->GetParentView()->GetLength(), 16).prepend("0x");
+ const auto fileSize = QString::number(view->GetLength(), 16).prepend("0x");
this->addField("Size: ", fileSize);
const auto bufferSize = fileSize.toUInt(nullptr, 16);
const auto fileBuffer = std::make_unique<char[]>(bufferSize);
- bv->GetParentView()->Read(fileBuffer.get(), 0, bufferSize);
+ view->Read(fileBuffer.get(), 0, bufferSize);
const auto fileBytes = QByteArray(fileBuffer.get(), bufferSize);
this->addHashField("MD5: ", QCryptographicHash::Md5, fileBytes);
@@ -95,5 +96,4 @@ FileInfoWidget::FileInfoWidget(QWidget* parent, BinaryViewRef bv)
this->m_layout->setColumnMinimumWidth(FileInfoWidget::m_maxColumns * 3 - 1, scaledWidth);
this->m_layout->setColumnStretch(FileInfoWidget::m_maxColumns * 3 - 1, 1);
setLayout(this->m_layout);
-}
-
+} \ No newline at end of file