Merge pull request #1576 from lioncash/null

cheats: null checks on functions
This commit is contained in:
Twinaphex 2015-04-03 20:16:16 +02:00
commit 4f2547976c

View File

@ -35,6 +35,9 @@ void cheat_manager_apply_cheats(cheat_manager_t *handle)
{
unsigned i, idx = 0;
if (!handle)
return;
pretro_cheat_reset();
for (i = 0; i < handle->size; i++)
@ -185,6 +188,9 @@ bool cheat_manager_realloc(cheat_manager_t *handle, unsigned new_size)
{
unsigned i;
if (!handle)
return false;
if (!handle->cheats)
handle->cheats = (struct item_cheat*)
calloc(new_size, sizeof(struct item_cheat));
@ -236,6 +242,9 @@ void cheat_manager_update(cheat_manager_t *handle, unsigned handle_idx)
{
char msg[256];
if (!handle)
return;
snprintf(msg, sizeof(msg), "Cheat: #%u [%s]: %s",
handle_idx, handle->cheats[handle_idx].state ? "ON" : "OFF",
(handle->cheats[handle_idx].desc) ?