libpayload: Fix potential NULL pointer dereference