Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: CustomForm 崩溃 #1502

Closed
KobeBryant114514 opened this issue Mar 31, 2024 · 0 comments
Closed

[Bug]: CustomForm 崩溃 #1502

KobeBryant114514 opened this issue Mar 31, 2024 · 0 comments
Labels
bug Related to software malfunction

Comments

@KobeBryant114514
Copy link
Contributor

KobeBryant114514 commented Mar 31, 2024

Describe the bug

此Bug仅能在 LL 0.10.4 复现

向玩家发送一个 ll::form::CustomForm form;
如果玩家点击了提交按钮,服务器就会崩溃。

具体为,只要 ll::form::CustomFormResult 这一个 optional不为空,无论后面写什么代码或者说不写代码,服务器就会崩溃。

To Reproduce

LL 0.10.4环境下

    ll::form::CustomForm form;
    form.setTitle("CustomForm")
        .appendLabel("label")
        .appendInput("input1", "input")
        .appendToggle("toggle", "toggle")
        .appendSlider("slider", "slider", 0, 100, 1)
        .appendStepSlider("stepSlider", "stepSlider", {"a", "b", "c"})
        .appendDropdown("dropdown", "dropdown", {"a", "b", "c"})
        .sendTo(pl, [](Player&, ll::form::CustomFormResult const& data, std::optional<ModalFormCancelReason>) {
            if (!data) {
                logger.info("CustomForm callback canceled");
                return;
            }
            for (auto [name, result] : *data) {
                static auto logDebugResult = [&](const ll::form::CustomFormElementResult& var) {
                    if (std::holds_alternative<uint64_t>(var)) {
                        logger.info("CustomForm callback {} = {}", name, std::get<uint64_t>(var));
                    } else if (std::holds_alternative<double>(var)) {
                        logger.info("CustomForm callback {} = {}", name, std::get<double>(var));
                    } else if (std::holds_alternative<std::string>(var)) {
                        logger.info("CustomForm callback {} = {}", name, std::get<std::string>(var));
                    }
                };
                logDebugResult(result);
            }
        });

以上代码来自 LL 的 Test https://github.com/LiteLDev/LeviLamina/blob/main/src/ll/test/FormTest.cpp

创建一个Custom发送给玩家
如果玩家点击了 x 关闭表单,则一切正常。
如果玩家点击了提交按钮,则服务器崩溃。

所以说这 Test 测了个寂寞?

Expected behavior

如果玩家点击了提交按钮,服务器不会崩溃。

Screenshots

No response

Platform

Windows11

Version

0.10.4

Additional context

No response

@KobeBryant114514 KobeBryant114514 added the bug Related to software malfunction label Mar 31, 2024
ShrBox added a commit that referenced this issue Apr 1, 2024
@ShrBox ShrBox closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Related to software malfunction
Development

No branches or pull requests

2 participants