mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge pull request #1576 from lioncash/null
cheats: null checks on functions
This commit is contained in:
commit
4f2547976c
9
cheats.c
9
cheats.c
@ -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) ?
|
||||
|
Loading…
x
Reference in New Issue
Block a user