Skip to content

Commit

Permalink
fix division by zero in monitor i command, should fix #2130
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45512 379a1393-f5fb-40a0-bcee-ef074d9b53f7
  • Loading branch information
mrdudz committed Mar 3, 2025
1 parent da10123 commit 2ed3739
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vice/src/monitor/mon_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,16 @@ void mon_memory_display(int radix_type, MON_ADDR start_addr, MON_ADDR end_addr,
int bank;

mem_get_screen_parameter(&base, &rows, &screen_width, &bank);
/* HACK: mem_get_screen_parameter() returns actual screen size from the
video chip registers - this can be zero rows or zero columns! If
width is 0, use last known terminal width instead, to avoid division
by 0 further below. */
if (screen_width == 0) {
screen_width = last_known_xres;
}

max_width = screen_width;

if (max_width > (last_known_xres - (7 + 2))) {
max_width = (last_known_xres - (7 + 2));
/* to make the output easier to read, make sure the number of items
Expand Down

0 comments on commit 2ed3739

Please sign in to comment.