Avoid NullPointerExceptions in empty sections

When a section is empty, the result list is omitted from the Json but
the Json result still contains a "limits" element. Thus checking for
result.size() == 0 is not robust enough. So check for the actual list
element to exist.