Fix segfault

This commit is contained in:
Miloslav Ciz 2024-09-27 00:55:30 +02:00
parent e9f919052c
commit 53096517c9
2 changed files with 5 additions and 4 deletions

View file

@ -1,7 +1,7 @@
#include <stdio.h>
#include <SDL2/SDL.h>
#define LCR_SETTING_LOG_LEVEL 5
#define LCR_SETTING_LOG_LEVEL 0
#include "game.h"
#include "debug.h"

View file

@ -917,7 +917,7 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h,
if (x < 0)
{
if (-1 * x > ((int) w))
if (-1 * x >= ((int) w))
return;
w += x;
@ -936,12 +936,13 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h,
y = 0;
}
if (y + h > LCR_EFFECTIVE_RESOLUTION_X)
if (y + h > LCR_EFFECTIVE_RESOLUTION_Y)
h = LCR_EFFECTIVE_RESOLUTION_Y - y;
unsigned long index = y * LCR_EFFECTIVE_RESOLUTION_X + x;
if (dither)
if (0)
// if (dither)
{
uint8_t parity = (x % 2) == (y % 2);