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

Handle SDL_GetBasePath() returning null. #423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xibbert
Copy link

@xibbert xibbert commented Sep 20, 2022

SDL_GetBasePath() returns null on systems that don't implement it.

Set to "./" per SDL docs example.

My OS (apparently) doesn't implement SDL_GetBasePath() and the emulator was crashing on startup.

Note: I haven't tested this on Windows, I don't have a way to do so. I don't know whether Windows gets upset about "./".

SDL_GetBasePath() returns null on systems that don't implement it.

Set to "./" per SDL docs example.
@@ -515,10 +515,15 @@ main(int argc, char **argv)

char *base_path = SDL_GetBasePath();

if (!base_path) {
base_path = SDL_strdup("./");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure you need to allocate a copy of this string? The following should work:

base_path = "./"

This way, you don't have to SDL_free() later.

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