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

Unable to obtain keyword #68

Open
cppcooper opened this issue May 18, 2023 · 0 comments
Open

Unable to obtain keyword #68

cppcooper opened this issue May 18, 2023 · 0 comments

Comments

@cppcooper
Copy link

cppcooper commented May 18, 2023

This code seems to exhibit UB, sometimes getting the keyword would work.. but most of the time it is null. And sometimes it crashes.

if (auto actor = a_ref->As<RE::Actor>(); actor) {
    auto dobj = RE::BGSDefaultObjectManager::GetSingleton();
    if (!dobj) {
        logger::error("This was it, the segfault. dobj was null"); //said line 112, which was an empty line after animal_keyword =
        return false;
    }
    auto animal_keyword = dobj->GetObject<RE::BGSKeyword>(RE::DEFAULT_OBJECT::kKeywordAnimal);

    // actor was already checked
    if (!actor->IsDead()
        || actor->IsSummoned()
        || (disable_for_animals && actor->HasKeyword(animal_keyword)))
    {
        return false;
    }
}

Could be related to #66

mrowrpurr pushed a commit to mrowrpurr/CommonLibSSE that referenced this issue Sep 2, 2023
ref CharmedBaryon#68
The added constructor (w/ new DeviceFactory) causes linker error attempting to call `BSInputDevice::IsPressed()` virtual function, this forces compiler to instantiate the class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant