mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
fix segfault when pressing f or t in graph mode without a defined func
This commit is contained in:
parent
9501ecf38c
commit
f7d1ce8771
@ -433,7 +433,7 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
|||||||
while ((pos = instr.plainText.indexOf(highlight_token->content, pos + 1)) != -1) {
|
while ((pos = instr.plainText.indexOf(highlight_token->content, pos + 1)) != -1) {
|
||||||
int tokenEnd = pos + highlight_token->content.length();
|
int tokenEnd = pos + highlight_token->content.length();
|
||||||
|
|
||||||
if ((pos > 0 && instr.plainText[pos - 1].isLetterOrNumber())
|
if ((pos > 0 && instr.plainText[pos - 1].isLetterOrNumber())
|
||||||
|| (tokenEnd < instr.plainText.length() && instr.plainText[tokenEnd].isLetterOrNumber())) {
|
|| (tokenEnd < instr.plainText.length() && instr.plainText[tokenEnd].isLetterOrNumber())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -653,6 +653,10 @@ void DisassemblerGraphView::zoomReset()
|
|||||||
void DisassemblerGraphView::takeTrue()
|
void DisassemblerGraphView::takeTrue()
|
||||||
{
|
{
|
||||||
DisassemblyBlock *db = blockForAddress(seekable->getOffset());
|
DisassemblyBlock *db = blockForAddress(seekable->getOffset());
|
||||||
|
if (!db) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (db->true_path != RVA_INVALID) {
|
if (db->true_path != RVA_INVALID) {
|
||||||
seekable->seek(db->true_path);
|
seekable->seek(db->true_path);
|
||||||
} else if (blocks[db->entry].exits.size()) {
|
} else if (blocks[db->entry].exits.size()) {
|
||||||
@ -663,6 +667,10 @@ void DisassemblerGraphView::takeTrue()
|
|||||||
void DisassemblerGraphView::takeFalse()
|
void DisassemblerGraphView::takeFalse()
|
||||||
{
|
{
|
||||||
DisassemblyBlock *db = blockForAddress(seekable->getOffset());
|
DisassemblyBlock *db = blockForAddress(seekable->getOffset());
|
||||||
|
if (!db) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (db->false_path != RVA_INVALID) {
|
if (db->false_path != RVA_INVALID) {
|
||||||
seekable->seek(db->false_path);
|
seekable->seek(db->false_path);
|
||||||
} else if (blocks[db->entry].exits.size()) {
|
} else if (blocks[db->entry].exits.size()) {
|
||||||
@ -735,7 +743,7 @@ DisassemblerGraphView::Token * DisassemblerGraphView::getToken(Instr * instr, in
|
|||||||
|
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
QRegularExpressionMatch match = i.next();
|
QRegularExpressionMatch match = i.next();
|
||||||
|
|
||||||
if (match.capturedStart() <= clickedCharPos && match.capturedEnd() > clickedCharPos) {
|
if (match.capturedStart() <= clickedCharPos && match.capturedEnd() > clickedCharPos) {
|
||||||
Token * t = new Token;
|
Token * t = new Token;
|
||||||
t->start = match.capturedStart();
|
t->start = match.capturedStart();
|
||||||
|
Loading…
Reference in New Issue
Block a user