aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <alex@ozal.ski>2024-02-02 00:35:53 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2024-02-02 00:54:26 +0100
commitba427a469a8394cb2fafa1a0602d6fd78c5c4d68 (patch)
tree2e4580491d7372d6fc0bb1a97bc89033659a7fdd
parentsway/output: Improve logging of swaybg execvp failure and more checks (diff)
downloadsway-ba427a469a8394cb2fafa1a0602d6fd78c5c4d68.tar.gz
sway-ba427a469a8394cb2fafa1a0602d6fd78c5c4d68.tar.zst
sway-ba427a469a8394cb2fafa1a0602d6fd78c5c4d68.zip
Ensure get_text_width() returns a positive value
Closes: https://github.com/swaywm/sway/issues/7940
-rw-r--r--sway/sway_text_node.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sway/sway_text_node.c b/sway/sway_text_node.c
index b9a77d94..664db40e 100644
--- a/sway/sway_text_node.c
+++ b/sway/sway_text_node.c
@@ -58,11 +58,11 @@ struct text_buffer {
58}; 58};
59 59
60static int get_text_width(struct sway_text_node *props) { 60static int get_text_width(struct sway_text_node *props) {
61 int width = props->width;
61 if (props->max_width) { 62 if (props->max_width) {
62 return MIN(props->max_width, props->width); 63 width = MIN(width, props->max_width);
63 } 64 }
64 65 return MAX(width, 0);
65 return props->width;
66} 66}
67 67
68static void update_source_box(struct text_buffer *buffer) { 68static void update_source_box(struct text_buffer *buffer) {