This avoids a divide by zero when the input and/or map are malformed. Signed-off-by: Sage Weil <sage@newdream.net>