From 251306a4bba6cca80ef552cdec30547155dea58c Mon Sep 17 00:00:00 2001 From: Ian J Date: Fri, 19 Aug 2022 13:43:55 -0400 Subject: [PATCH] Fixed divide by zero segault (#461) Check if inner_size is less than 1 to prevent divide by 0 segfault. Co-authored-by: Arthur Sonzogni --- src/ftxui/dom/scroll_indicator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ftxui/dom/scroll_indicator.cpp b/src/ftxui/dom/scroll_indicator.cpp index c96fdbb..2f1cfe2 100644 --- a/src/ftxui/dom/scroll_indicator.cpp +++ b/src/ftxui/dom/scroll_indicator.cpp @@ -40,6 +40,9 @@ Element vscroll_indicator(Element child) { const Box& stencil = screen.stencil; int size_inner = box_.y_max - box_.y_min; + if (size_inner <= 0) { + return; + } int size_outter = stencil.y_max - stencil.y_min + 1; if (size_outter >= size_inner) { return;