From c62a667fb1964cc5febeaf10fd12f62bf0baf793 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Mon, 9 Sep 2019 13:39:53 -0700 Subject: [PATCH] Fix null pointer check (clang warnings) --- rpcs3/Emu/Cell/Modules/sceNp.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/Emu/Cell/Modules/sceNp.cpp index d73e263f28..c42010c173 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -716,7 +716,7 @@ error_code sceNpBasicSendMessage(vm::cptr to, vm::cptr data, u64 return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!to || !to->handle.data || !data || !size) + if (!to || to->handle.data[0] == '\0' || !data || !size) { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } @@ -738,7 +738,7 @@ error_code sceNpBasicSendMessageGui(vm::cptr msg, sys_ return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!msg || msg->count > SCE_NP_BASIC_SEND_MESSAGE_MAX_RECIPIENTS || !msg->npids.handle.data || !(msg->msgFeatures & SCE_NP_BASIC_MESSAGE_FEATURES_ALL_FEATURES)) + if (!msg || msg->count > SCE_NP_BASIC_SEND_MESSAGE_MAX_RECIPIENTS || msg->npids.handle.data[0] == '\0' || !(msg->msgFeatures & SCE_NP_BASIC_MESSAGE_FEATURES_ALL_FEATURES)) { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } @@ -765,7 +765,7 @@ error_code sceNpBasicSendMessageAttachment(vm::cptr to, vm::cptr return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!to || !to->handle.data || !data || !size) + if (!to || to->handle.data[0] == '\0' || !data || !size) { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } @@ -872,7 +872,7 @@ error_code sceNpBasicAddFriend(vm::cptr contact, vm::cptr body, s return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!contact || !contact->handle.data) + if (!contact || contact->handle.data[0] == '\0') { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } @@ -1021,7 +1021,7 @@ error_code sceNpBasicAddPlayersHistory(vm::cptr npid, vm::ptr des return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!npid || !npid->handle.data) + if (!npid || npid->handle.data[0] == '\0') { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } @@ -1043,7 +1043,7 @@ error_code sceNpBasicAddPlayersHistoryAsync(vm::cptr npids, u64 count, return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!npids || !npids->handle.data) + if (!npids || npids->handle.data[0] == '\0') { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; } @@ -1115,7 +1115,7 @@ error_code sceNpBasicAddBlockListEntry(vm::cptr npid) return SCE_NP_BASIC_ERROR_NOT_INITIALIZED; } - if (!npid || !npid->handle.data) + if (!npid || npid->handle.data[0] == '\0') { return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT; }