Parcourir la source

[rcore] fix crash in InitWindow, due to unchecked result of InitPlatform

Check the result of InitPlatform(), if it isn't 0, report the Error
and return. This prevent crashes and allows for gracefully aborting
or recovering by checking IsWindowReady().

Partially-fixes: https://github.com/raysan5/raylib/issues/4801
pull/4803/head
sleeptightAnsiC il y a 9 mois
Parent
révision
78572cd690
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. +4
    -1
      src/rcore.c

+ 4
- 1
src/rcore.c Voir le fichier

@ -681,7 +681,10 @@ void InitWindow(int width, int height, const char *title)
// Initialize platform // Initialize platform
//-------------------------------------------------------------- //--------------------------------------------------------------
InitPlatform();
if(InitPlatform() != 0) {
TRACELOG(LOG_ERROR, "SYSTEM: Failed to initialize Platform");
return;
}
//-------------------------------------------------------------- //--------------------------------------------------------------
// Initialize rlgl default data (buffers and shaders) // Initialize rlgl default data (buffers and shaders)

Chargement…
Annuler
Enregistrer