Fix dropdown fuzzer. (#243)

This commit is contained in:
Arthur Sonzogni
2021-10-22 14:04:07 +02:00
committed by GitHub
parent 313ce9c35f
commit f80d9b5cfd
3 changed files with 8 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
#include <cmath>
#include <memory> // for __shared_ptr_access
#include <string> // for string
#include <utility> // for move
@@ -28,6 +29,7 @@ Component Dropdown(ConstStringListRef entries, int* selected) {
}
Element Render() override {
*selected_ = std::min((int)entries_.size() - 1, std::max(0, *selected_));
title_ = entries_[*selected_];
if (show_) {
return vbox({