From 32a4b4baabb8b50ac5a8acb382db27c779bfd7f5 Mon Sep 17 00:00:00 2001 From: 00JCIV00 Date: Tue, 27 Feb 2024 14:24:11 -0500 Subject: [PATCH] Added bounds protection to Alignment Window initialization --- src/widgets/alignment.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/alignment.zig b/src/widgets/alignment.zig index f714479..bab5e5b 100644 --- a/src/widgets/alignment.zig +++ b/src/widgets/alignment.zig @@ -1,7 +1,7 @@ const Window = @import("../Window.zig"); pub fn center(parent: Window, cols: usize, rows: usize) Window { - const y_off = (parent.height / 2) - (rows / 2); - const x_off = (parent.width / 2) - (cols / 2); + const y_off = (parent.height / 2) -| (rows / 2); + const x_off = (parent.width / 2) -| (cols / 2); return parent.initChild(x_off, y_off, .{ .limit = cols }, .{ .limit = rows }); }