From 6b2dcaa957cfa741582e32038f24050c49c54e58 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 4 Nov 2018 04:51:14 -0500 Subject: [PATCH] check and avoid crashes --- GUI/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index 7fc777d..d2321f4 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -161,6 +161,7 @@ QVector MainWindow::GetAllHooks(DWORD processId) { QSet addresses; QVector hooks; + if (!processId) return hooks; for (int i = 0; i < ttCombo->count(); ++i) { ThreadParam tp = ParseTextThreadString(ttCombo->itemText(i)); @@ -187,6 +188,7 @@ void MainWindow::on_attachButton_clicked() void MainWindow::on_detachButton_clicked() { + if (processCombo->count() == 0) return; Host::DetachProcess(GetSelectedProcessId()); } @@ -195,6 +197,7 @@ void MainWindow::on_hookButton_clicked() bool ok; QString hookCode = QInputDialog::getText(this, ADD_HOOK, CODE_INFODUMP, QLineEdit::Normal, "", &ok, Qt::WindowCloseButtonHint); if (!ok) return; + if (processCombo->count() == 0) return; if (auto hp = ParseCode(hookCode)) Host::InsertHook(GetSelectedProcessId(), hp.value()); else Host::AddConsoleOutput(INVALID_CODE); }