From 4a49acc2f2fb03d68d79e86913a81e96517bf075 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 3 Apr 2017 01:03:05 +0200 Subject: [PATCH] Fix null deref crash in comments --- src/widgets/memwidget/memorywidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widgets/memwidget/memorywidget.cpp b/src/widgets/memwidget/memorywidget.cpp index 4f56372e..bfbcf9be 100644 --- a/src/widgets/memwidget/memorywidget.cpp +++ b/src/widgets/memwidget/memorywidget.cpp @@ -1077,7 +1077,7 @@ void MemoryWidget::on_actionDisasAdd_comment_triggered() { // Get current offset QTextCursor tc = this->disasTextEdit->textCursor(); - tc.select( QTextCursor::LineUnderCursor ); + tc.select( QTextCursor::LineUnderCursor); QString lastline = tc.selectedText(); QString ele = lastline.split(" ", QString::SkipEmptyParts)[0]; if (ele.contains("0x")) { @@ -1091,7 +1091,9 @@ void MemoryWidget::on_actionDisasAdd_comment_triggered() // Rename function in r2 core this->main->core->setComment(ele, comment); // Seek to new renamed function - this->main->seek(fcn->name); + if (fcn) { + this->main->seek(fcn->name); + } // TODO: Refresh functions tree widget } }