Skip to content

Commit

Permalink
SDL_Get*Driver() functions: Set error message on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Sackzement authored and slouken committed Feb 14, 2025
1 parent ed0a03e commit c16b7bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/audio/SDL_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const char *SDL_GetAudioDriver(int index)
if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
return deduped_bootstrap[index]->name;
}
SDL_InvalidParamError("index");
return NULL;
}

Expand Down
1 change: 1 addition & 0 deletions src/camera/SDL_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const char *SDL_GetCameraDriver(int index)
if (index >= 0 && index < SDL_GetNumCameraDrivers()) {
return bootstrap[index]->name;
}
SDL_InvalidParamError("index");
return NULL;
}

Expand Down
3 changes: 1 addition & 2 deletions src/render/SDL_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,7 @@ const char *SDL_GetRenderDriver(int index)
{
#ifndef SDL_RENDER_DISABLED
if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
SDL_SetError("index must be in the range of 0 - %d",
SDL_GetNumRenderDrivers() - 1);
SDL_InvalidParamError("index");
return NULL;
}
return render_drivers[index]->name;
Expand Down
1 change: 1 addition & 0 deletions src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ const char *SDL_GetVideoDriver(int index)
if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
return deduped_bootstrap[index]->name;
}
SDL_InvalidParamError("index");
return NULL;
}

Expand Down

0 comments on commit c16b7bc

Please sign in to comment.