mirror of
https://github.com/love2d/love.git
synced 2026-08-14 10:13:46 +02:00
Fixed some potential instability or crash issues
This commit is contained in:
@@ -338,7 +338,8 @@ int w_newFont(lua_State *L)
|
||||
int ret = luax_pconvobj(L, idxs, 2, "font", "newRasterizer");
|
||||
if (ret != 0)
|
||||
{
|
||||
font_data->release();
|
||||
if (font_data)
|
||||
font_data->release();
|
||||
return lua_error(L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ Joystick::Joystick()
|
||||
|
||||
// Open all connected joysticks.
|
||||
int numjoysticks = this->getNumJoysticks();
|
||||
this->joysticks = (SDL_Joystick **)calloc(numjoysticks, sizeof(SDL_Joystick *));
|
||||
if (numjoysticks > 0)
|
||||
this->joysticks = (SDL_Joystick **)calloc(numjoysticks, sizeof(SDL_Joystick *));
|
||||
|
||||
for (int i = 0; i<numjoysticks; i++)
|
||||
this->open(i);
|
||||
@@ -79,7 +80,8 @@ void Joystick::reload()
|
||||
throw love::Exception("%s", SDL_GetError());
|
||||
|
||||
int numjoysticks = this->getNumJoysticks();
|
||||
this->joysticks = (SDL_Joystick **)calloc(numjoysticks, sizeof(SDL_Joystick *));
|
||||
if (numjoysticks > 0)
|
||||
this->joysticks = (SDL_Joystick **)calloc(numjoysticks, sizeof(SDL_Joystick *));
|
||||
|
||||
for (int i = 0; i<numjoysticks; i++)
|
||||
this->open(i);
|
||||
|
||||
@@ -134,7 +134,7 @@ bool Window::setWindow(int width, int height, WindowFlags *flags)
|
||||
// FSAA might have caused the failure, disable it and try again
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
failed = SDL_SetVideoMode(width, height, 32, sdlflags) == 0;
|
||||
failed = (surface = SDL_SetVideoMode(width, height, 32, sdlflags)) == 0;
|
||||
}
|
||||
if (failed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user