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

Fix CTD on debugmsg with no Lua instance #3187

Merged
merged 1 commit into from
Sep 21, 2023
Merged

Conversation

olanti-p
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Fix CTD on debugmsg with no Lua instance"

Purpose of change

Fix CTD when debugmsg tries to print Lua backtrace, but there is no Lua state available.

Describe the solution

Add nullptr check

Testing

Added fake debugmsg on game start, game no longer CTDs from it.

@github-actions github-actions bot added the src changes related to source code. label Sep 20, 2023
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe could we use std::optional?

@olanti-p
Copy link
Contributor Author

Unfortunately std::optional<T> needs full definition of T, but I've deliberately hidden definition of cata::lua_state to avoid recompilations when switching between Lua and non-Lua builds.

The entire thing should be moved somewhere else to be honest, maybe with global accessor like get_map() or get_avatar(), it doesn't make sense to keep it in DynamicDataLoader after data has been loaded.

@olanti-p olanti-p merged commit 6e385d6 into upload Sep 21, 2023
16 checks passed
@olanti-p olanti-p deleted the fix-lua-backtrace-ctd branch September 21, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants