Check that unit isn't NULL before using it, which could happen if card