From fb77f90e4a2bdafe007a8810a13395cfb65a4340 Mon Sep 17 00:00:00 2001 From: hynak Date: Sun, 25 Jan 2026 14:23:12 -0500 Subject: [PATCH] fix crash in start_pos calc --- src/animations/DurFile.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/animations/DurFile.zig b/src/animations/DurFile.zig index 42f66e9..9ec9eaf 100644 --- a/src/animations/DurFile.zig +++ b/src/animations/DurFile.zig @@ -318,9 +318,11 @@ fn calc_start_position(terminal_buffer: *TerminalBuffer, dur_movie: *DurFormat, const buf_width: u32 = @intCast(terminal_buffer.width); const buf_height: u32 = @intCast(terminal_buffer.height); - const movie_width: u32 = @intCast(dur_movie.columns.?); - const movie_height: u32 = @intCast(dur_movie.lines.?); + var movie_width: u32 = @intCast(dur_movie.columns.?); + var movie_height: u32 = @intCast(dur_movie.lines.?); + if (movie_width > buf_width) movie_width = buf_width; + if (movie_height > buf_height) movie_height = buf_height; const start_pos: IVec2 = switch (offset_alignment) { DurOffsetAlignment.center => .{ center(buf_width) - center(movie_width), center(buf_height) - center(movie_height) },