Convert if-block to early return

This commit is contained in:
alexthesys 2021-12-07 11:57:05 +03:00 committed by Anton Kochkov
parent 7119017eae
commit 21ab0e2a9e

View File

@ -754,7 +754,9 @@ void HexWidget::w_writeBytes()
const int offset = bytes.startsWith("\\x") ? 2 : 0; const int offset = bytes.startsWith("\\x") ? 2 : 0;
const int incr = offset + 2; const int incr = offset + 2;
const int bytes_size = qMin(bytes.size() / incr, size); const int bytes_size = qMin(bytes.size() / incr, size);
if (ok && bytes_size) { if (!ok || !bytes_size) {
return;
}
uint8_t *buf = (uint8_t *)malloc(static_cast<size_t>(bytes_size)); uint8_t *buf = (uint8_t *)malloc(static_cast<size_t>(bytes_size));
if (!buf) { if (!buf) {
return; return;
@ -767,7 +769,6 @@ void HexWidget::w_writeBytes()
free(buf); free(buf);
refresh(); refresh();
} }
}
void HexWidget::w_writeZeros() void HexWidget::w_writeZeros()
{ {