mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-25 20:27:31 +08:00
Fix dropdown fuzzer. (#243)
This commit is contained in:
parent
313ce9c35f
commit
f80d9b5cfd
@ -1,9 +1,13 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
released (development)
|
unreleased (development)
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
# Bug:
|
||||||
|
- Check the selected element are within bounds for Dropdown.
|
||||||
|
|
||||||
|
|
||||||
0.11
|
0.11
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Component GeneratorComponent(const char*& data, size_t& size, int depth) {
|
|||||||
if (depth <= 0)
|
if (depth <= 0)
|
||||||
return Button(GeneratorString(data, size), [] {});
|
return Button(GeneratorString(data, size), [] {});
|
||||||
|
|
||||||
switch (value % 18) {
|
switch (value % 19) {
|
||||||
case 1:
|
case 1:
|
||||||
return Checkbox(GeneratorString(data, size), &g_bool);
|
return Checkbox(GeneratorString(data, size), &g_bool);
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <cmath>
|
||||||
#include <memory> // for __shared_ptr_access
|
#include <memory> // for __shared_ptr_access
|
||||||
#include <string> // for string
|
#include <string> // for string
|
||||||
#include <utility> // for move
|
#include <utility> // for move
|
||||||
@ -28,6 +29,7 @@ Component Dropdown(ConstStringListRef entries, int* selected) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Element Render() override {
|
Element Render() override {
|
||||||
|
*selected_ = std::min((int)entries_.size() - 1, std::max(0, *selected_));
|
||||||
title_ = entries_[*selected_];
|
title_ = entries_[*selected_];
|
||||||
if (show_) {
|
if (show_) {
|
||||||
return vbox({
|
return vbox({
|
||||||
|
Loading…
Reference in New Issue
Block a user