check if value is actually valid before attempting to store it (e.g. null)