samdb: Fix CID 1034736 Dereference after null check