mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Fix dropdown fuzzer. (#243)
This commit is contained in:
		@@ -1,9 +1,13 @@
 | 
			
		||||
Changelog
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
released (development) 
 | 
			
		||||
unreleased (development) 
 | 
			
		||||
------------------------
 | 
			
		||||
 | 
			
		||||
# Bug:
 | 
			
		||||
- Check the selected element are within bounds for Dropdown.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
0.11
 | 
			
		||||
----
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ Component GeneratorComponent(const char*& data, size_t& size, int depth) {
 | 
			
		||||
  if (depth <= 0)
 | 
			
		||||
    return Button(GeneratorString(data, size), [] {});
 | 
			
		||||
 | 
			
		||||
  switch (value % 18) {
 | 
			
		||||
  switch (value % 19) {
 | 
			
		||||
    case 1:
 | 
			
		||||
      return Checkbox(GeneratorString(data, size), &g_bool);
 | 
			
		||||
    case 2:
 | 
			
		||||
 
 | 
			
		||||
@@ -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({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user