Add argument string length checking to getDistance() method.