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 <sonzogniarthur@gmail.com>
This commit is contained in:
Ian J 2022-08-19 13:43:55 -04:00 committed by GitHub
parent 7cc68cfbd0
commit 251306a4bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,9 @@ Element vscroll_indicator(Element child) {
const Box& stencil = screen.stencil; const Box& stencil = screen.stencil;
int size_inner = box_.y_max - box_.y_min; int size_inner = box_.y_max - box_.y_min;
if (size_inner <= 0) {
return;
}
int size_outter = stencil.y_max - stencil.y_min + 1; int size_outter = stencil.y_max - stencil.y_min + 1;
if (size_outter >= size_inner) { if (size_outter >= size_inner) {
return; return;