summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2021-08-27 10:30:18 +0200
committerJosJuice <josjuice@gmail.com>2021-08-27 10:30:18 +0200
commitf17584fc066f115232d3fbfa83f3e1829671ef01 (patch)
tree080fc0f999bfda730328c4c96882989901e918df /Source/Core
parent559de262a1333da80a15525ce73503ca3346f997 (diff)
DolphinQt: Fix divide by zero in JITWidget::Update
I ran into this while fiddling with the debugger.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/Debugger/JITWidget.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt/Debugger/JITWidget.cpp b/Source/Core/DolphinQt/Debugger/JITWidget.cpp
index d83c601dc5..b0d37ed7fd 100644
--- a/Source/Core/DolphinQt/Debugger/JITWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/JITWidget.cpp
@@ -186,14 +186,22 @@ void JITWidget::Update()
ppc_disasm << st.numCycles << " estimated cycles" << std::endl;
ppc_disasm << "Num instr: PPC: " << code_block.m_num_instructions
- << " Host: " << host_instructions_count << " (blowup: "
- << 100 * host_instructions_count / code_block.m_num_instructions - 100 << "%)"
- << std::endl;
+ << " Host: " << host_instructions_count;
+ if (code_block.m_num_instructions != 0)
+ {
+ ppc_disasm << " (blowup: "
+ << 100 * host_instructions_count / code_block.m_num_instructions - 100 << "%)";
+ }
+ ppc_disasm << std::endl;
ppc_disasm << "Num bytes: PPC: " << code_block.m_num_instructions * 4
- << " Host: " << host_code_size
- << " (blowup: " << 100 * host_code_size / (4 * code_block.m_num_instructions) - 100
- << "%)" << std::endl;
+ << " Host: " << host_code_size;
+ if (code_block.m_num_instructions != 0)
+ {
+ ppc_disasm << " (blowup: " << 100 * host_code_size / (4 * code_block.m_num_instructions) - 100
+ << "%)";
+ }
+ ppc_disasm << std::endl;
m_ppc_asm_widget->setHtml(
QStringLiteral("<pre>%1</pre>").arg(QString::fromStdString(ppc_disasm.str())));