mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 07:43:01 +01:00
Check if path could be allocated, initialize it with an empty string.
This commit is contained in:
@@ -431,8 +431,14 @@ char* osinterface_open_directory_browser(char *title) {
|
|||||||
|
|
||||||
char* osinterface_get_orct2_homefolder()
|
char* osinterface_get_orct2_homefolder()
|
||||||
{
|
{
|
||||||
char *path;
|
char *path=NULL;
|
||||||
path = malloc(sizeof(char) * MAX_PATH);
|
path = malloc(sizeof(char) * MAX_PATH);
|
||||||
|
if (path == NULL){
|
||||||
|
osinterface_show_messagebox("Error allocating memory!");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
path[0] = '\0';
|
||||||
|
|
||||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, path))) { // find home folder
|
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, path))) { // find home folder
|
||||||
strcat(path, "\\OpenRCT2");
|
strcat(path, "\\OpenRCT2");
|
||||||
|
|||||||
Reference in New Issue
Block a user