Fix null deref (#101)

* Fix null deref when QStringList is empty

* Indent memory widget
This commit is contained in:
Sergi Àlvarez i Capilla 2017-04-09 19:09:52 +02:00 committed by Duncan Ogilvie
parent 7c63a67575
commit b7c3929d5e

View File

@ -461,11 +461,14 @@ void MemoryWidget::refreshDisasm(QString off = "") {
QTextCursor tc = this->disasTextEdit->textCursor();
tc.select( QTextCursor::LineUnderCursor );
QString lastline = tc.selectedText();
QString ele = lastline.split(" ", QString::SkipEmptyParts)[0];
QStringList elements = lastline.split(" ", QString::SkipEmptyParts);
if (elements.length() > 0) {
QString ele = elements[0];
if (ele.contains("0x")) {
this->main->core->cmd("s " + ele);
}
}
}
QString txt2 = this->main->core->cmd("pd 100");
this->disasTextEdit->setPlainText(txt2.trimmed());