netplay: allocate crashfix

Handle no devices
This commit is contained in:
SimpleTease 2020-12-23 01:35:41 +00:00 committed by GitHub
parent 7d313647ae
commit 033be6ca0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,10 @@ netplay_input_state_t netplay_input_state_for(
return NULL;
/* Couldn't find a slot, allocate a fresh one */
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t));
if (size > 1)
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state) + (size-1) * sizeof(uint32_t));
else
ret = (netplay_input_state_t)calloc(1, sizeof(struct netplay_input_state));
if (!ret)
return NULL;
*list = ret;