Validate 'nx' and 'ny' values only if they are not NULL