Skip to content

Commit

Permalink
Fix crash with large text
Browse files Browse the repository at this point in the history
Need to find a better way to render the dotted decoration. Will do that
later, just fix the crash for now.
  • Loading branch information
kovidgoyal committed Jan 18, 2025
1 parent 23cd7e3 commit 14d3a98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kitty/decorations.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ distribute_dots(unsigned available_space, unsigned num_of_dots, unsigned *summed

DecorationGeometry
add_dotted_underline(uint8_t *buf, FontCellMetrics fcm) {
unsigned num_of_dots = fcm.cell_width / (2 * fcm.underline_thickness);
unsigned num_of_dots = MAX(1u, fcm.cell_width / (2 * fcm.underline_thickness));
RAII_ALLOC(unsigned, spacing, malloc(num_of_dots * 2 * sizeof(unsigned)));
if (!spacing) fatal("Out of memory");
unsigned size = distribute_dots(fcm.cell_width, num_of_dots, spacing, spacing + num_of_dots);
Expand Down

0 comments on commit 14d3a98

Please sign in to comment.