He does check it. He first checks if there is a current weapon, if yes, he tries to make it invisible. Then he set the current weapon to the one from the array " weapon_slots_[index];", and he checked that this is not nullptr in the beginning already. The only thing that is somewhat wrong is the second “null” check at line 21. Because the one at line 3. should already prevent the pointer from being null.