Improve null safety of memorized recipe isValid check