Skip to content

Fix: screenshot crush when using non-ascii file path#1697

Merged
crudelios merged 1 commit intoKeriew:masterfrom
c3fan:fix_screenshot_crush
Mar 5, 2026
Merged

Fix: screenshot crush when using non-ascii file path#1697
crudelios merged 1 commit intoKeriew:masterfrom
c3fan:fix_screenshot_crush

Conversation

@xxoommd
Copy link
Copy Markdown

@xxoommd xxoommd commented Mar 2, 2026

When saving screenshot will cause the game to crash. The cause of the problem is the file path contains non-ASCII characters. Just make a NULL judgment before the pop-up window will avoid this crush.

@xxoommd xxoommd force-pushed the fix_screenshot_crush branch from 7c8c138 to d6adc77 Compare March 3, 2026 08:31
Comment thread src/graphics/screenshot.c Outdated
string_copy(prefix, notice_text, FILE_NAME_MAX);
int prefix_length = string_length(prefix);
string_copy(string_from_ascii(filename), &notice_text[prefix_length], FILE_NAME_MAX - prefix_length);
const uint8_t *ascii_filename = string_from_ascii(filename);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe use encoding_from_utf8 instead? That would possibly display the path even if there were non-ascii characters.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Maybe use encoding_from_utf8 instead? That would possibly display the path even if there were non-ascii characters.

Thank you for you advice. I force pushed this branch again.

@xxoommd xxoommd force-pushed the fix_screenshot_crush branch from d6adc77 to f5807bc Compare March 4, 2026 02:40
@crudelios crudelios merged commit d3c59b6 into Keriew:master Mar 5, 2026
17 checks passed
@xxoommd xxoommd deleted the fix_screenshot_crush branch March 6, 2026 01:05
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

Successfully merging this pull request may close these issues.

2 participants