1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Fix a few assertions that were found when using debug CRT

This commit is contained in:
Ted John
2018-03-06 19:40:50 +00:00
committed by Michał Janiszewski
parent cd6739c340
commit e318e0948a
3 changed files with 18 additions and 6 deletions

View File

@@ -69,8 +69,14 @@ public:
~HardwareDisplayDrawingEngine() override
{
SDL_DestroyTexture(_screenTexture);
SDL_DestroyTexture(_scaledScreenTexture);
if (_screenTexture != nullptr)
{
SDL_DestroyTexture(_screenTexture);
}
if (_scaledScreenTexture != nullptr)
{
SDL_DestroyTexture(_scaledScreenTexture);
}
SDL_FreeFormat(_screenTextureFormat);
SDL_DestroyRenderer(_sdlRenderer);
}
@@ -93,7 +99,10 @@ public:
void Resize(uint32 width, uint32 height) override
{
SDL_DestroyTexture(_screenTexture);
if (_screenTexture != nullptr)
{
SDL_DestroyTexture(_screenTexture);
}
SDL_FreeFormat(_screenTextureFormat);
SDL_RendererInfo rendererInfo = {};
@@ -128,7 +137,10 @@ public:
if (smoothNN)
{
SDL_DestroyTexture(_scaledScreenTexture);
if (_scaledScreenTexture != nullptr)
{
SDL_DestroyTexture(_scaledScreenTexture);
}
char scaleQualityBuffer[4];
snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%u", scaleQuality);

View File

@@ -567,7 +567,7 @@ static bool server_compare(const server_entry &a, const server_entry &b)
}
// Then by name
return String::Compare(a.name, b.name, true) <= 0;
return String::Compare(a.name, b.name, true) < 0;
}
static void sort_servers()

View File

@@ -44,7 +44,7 @@ static bool StringIsBlank(const utf8 * str)
{
for (auto ch = str; *ch != '\0'; ch++)
{
if (!isblank(*ch))
if (!isblank((uint8)*ch))
{
return false;
}