Add check for nil result block