Check if a gameobject is stored in a variable

I am making a pickup weapon script and I want to check if a weapon slot already has a weapon stored in it. If there is a weapon in it then I want the weapon to be stored in the next weapon slot.

If weapon1 is your gameObject container you can use

if ( playerWeaponManager.weapon1 != null ) {}

to check if its full.

But then it seems you already have a bool which you can use to handle it?

playerWeaponManager.weapon1Attained = true;