I asked this as well. This is @dmitchell said:

That check is in a loop over all the known mappings looking for the course one. If the course has not been mapped, it returns None. L 135 forces the mapping of the 'course' category location if the code goes through translate_location and the course has never been mapped before. Our usage pattern almost guarantees that the course node will be mapped b/c we map for the dashboard, but you bring up an interesting question about any odd cases. I guess the caller shouldn't count on the map being successful (i.e., it may have a Locator for which it cannot determine the old style course id)