Fix sceNpBasicSetPresence when data is nullptr and size is 0

This commit is contained in:
RipleyTom 2024-01-05 16:34:29 +01:00 committed by Megamouse
parent 2a1af17f67
commit 0227b16d06
2 changed files with 5 additions and 5 deletions

View File

@ -846,7 +846,7 @@ error_code sceNpBasicSetPresence(vm::cptr<u8> data, u32 size)
}
// Not checked by API
ensure(data);
ensure(data || !size, "Access violation");
std::vector pr_data(data.get_ptr(), data.get_ptr() + size);
nph.set_presence(std::nullopt, pr_data);
@ -876,7 +876,7 @@ error_code sceNpBasicSetPresenceDetails(vm::cptr<SceNpBasicPresenceDetails> pres
}
// Not checked by API
ensure(pres);
ensure(pres, "Access violation");
if (pres->size > SCE_NP_BASIC_MAX_PRESENCE_SIZE)
{
@ -923,7 +923,7 @@ error_code sceNpBasicSetPresenceDetails2(vm::cptr<SceNpBasicPresenceDetails2> pr
}
// Not checked by API
ensure(pres);
ensure(pres, "Access violation");
if (pres->size > SCE_NP_BASIC_MAX_PRESENCE_SIZE)
{

View File

@ -823,8 +823,8 @@ namespace np
for (auto& [npid, pr_info] : current_presences)
{
// Only communicates info about online users with presence
if (!pr_info.online || pr_info.pr_com_id.data[0] == 0)
// Only communicates info about online users
if (!pr_info.online)
{
continue;
}