ref: 142db71cb95a0d82138247a1df1873ab2607c39d
parent: 611afe7417d63d716531f2ba9f6ae4a2d570a6b8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Sep 14 20:07:10 EDT 2020
Move sanity checks to Draw.cpp There, no need to keep track of a bunch of duplicate sanity checks
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -412,6 +412,9 @@
void BackupSurface(SurfaceID surf_no, const RECT *rect)
{
+ if (surf[surf_no] == NULL)
+ return;
+
static RenderBackend_Rect rcSet; // TODO - Not the original variable name
rcSet.left = rect->left * mag;
rcSet.top = rect->top * mag;
@@ -427,6 +430,9 @@
void PutBitmap3(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no) // Transparency
{
+ if (surf[surf_no] == NULL)
+ return;
+
static RenderBackend_Rect rcWork;
rcWork.left = rect->left;
@@ -466,6 +472,9 @@
void PutBitmap4(const RECT *rcView, int x, int y, const RECT *rect, SurfaceID surf_no) // No Transparency
{
+ if (surf[surf_no] == NULL)
+ return;
+
static RenderBackend_Rect rcWork;
rcWork.left = rect->left;
@@ -505,6 +514,9 @@
void Surface2Surface(int x, int y, const RECT *rect, SurfaceID to, SurfaceID from)
{
+ if (surf[to] == NULL || surf[from] == NULL)
+ return;
+
static RenderBackend_Rect rcWork;
rcWork.left = rect->left * mag;
@@ -546,6 +558,9 @@
void CortBox2(const RECT *rect, unsigned long col, SurfaceID surf_no)
{
+ if (surf[surf_no] == NULL)
+ return;
+
static RenderBackend_Rect rcSet; // TODO - Not the original variable name
rcSet.left = rect->left * mag;
rcSet.top = rect->top * mag;
@@ -700,6 +715,9 @@
void PutText2(int x, int y, const char *text, unsigned long color, SurfaceID surf_no)
{
+ if (surf[surf_no] == NULL)
+ return;
+
DrawText(font, surf[surf_no], x * mag, y * mag, color, text);
}