LiteLDev / LeviLamina

A lightweight, modular and versatile mod loader for Minecraft Bedrock Edition, formerly known as LiteLoaderBDS
https://levimc.org/software/levilamina
GNU Lesser General Public License v3.0
1.14k stars 117 forks source link

[Bug]: CustomForm崩溃 #1578

Closed engsr6982 closed 1 month ago

engsr6982 commented 1 month ago

Describe the bug

CustomForm表单,appendDropdown 如果传递空的 vector<string>,在玩家提交表单后引发崩溃

To Reproduce

这是我的代码,我已去掉了其它无关内容进行测试,它能复现异常

    CustomForm fm{PLUGIN_TITLE};

    std::vector<string> names;
    // ll::service::getLevel()->forEachPlayer([&names, &player](Player& p) {
    //     if (p == player) return true; // 排除自己
    //     names.push_back(p.getRealName());
    //     return true;
    // });

    fm.appendDropdown("choose_player", "[在线] 选择共享者:", names);

    // fm.appendInput("input_player", "[离线] 输入共享者的名字:", "string");

    // fm.appendToggle("switch_online_offline", "在线 <-> 离线");

    fm.sendTo(player, [](Player& pl, CustomFormResult const& dt, FormCancelReason) {});

Expected behavior

DropDown返回的是vector里面的元素,我认为他应该正常运行

Screenshots

image

Platform

win11

Version

LeviLamina-0.13.5+f4a975491

Additional context

No response