unlike is.null and nrow ; is.na is vectorised so perhaps you would use any(is.na(r)) so that it would be assessed to a singular output.
However, your program may still struggle depending on the input (map) something like list(NULL,NULL) as r would evaluate to NA which is neither TRUE nor FALSE ; though you probably would wish it to be false ? Its not clear what r would be expected to be, and so how to handle it.