sm/notifications: Prevent potential null pointer dereference in ReceiveNotification

Based off the conditions, this is a potential null pointer dereference
that can occur. We need to check for null before accessing
nbPendingNotifications.

This is unlikely to occur in common usage, however it's a fairly
straightforward amendment.
This commit is contained in:
Lioncash 2019-08-13 03:01:24 -04:00
parent a2e46919c1
commit c95b59c72e

View File

@ -101,7 +101,7 @@ Result ReceiveNotification(SessionData *sessionData, u32 *notificationId)
if(processData == NULL || !processData->notificationEnabled || processData->nbPendingNotifications == 0)
{
if(processData->nbPendingNotifications)
if(processData != NULL && processData->nbPendingNotifications)
*notificationId = 0;
return 0xD8806404;
}