Thought about it some more, and I realized that it's also possible that `times` IS NOT null, but it's empty (at least for 1 value of `cat`). In that case, `times.get(cat)` could be null, and the NPE is thrown when it tries to convert it to an integer to add to `sum`.

If that's the case, then I would get rid of the try-catch and instead make a call to `times.containsKey(cat)` before trying to get it and add it to `sum`.