collectiveintel/cif-v1 — pull request #68 by rtkpmcalpine (2014-04-10 18:20:01+00:00)
Title: Avoid API errors with empty results and nolog

If a query is made via the API for a subject with no results and nolog
is passed there will be no data returned. This was causing a 'Can't use
an undefined value as an ARRAY reference' error and apache would return
500.

This change adds a check to ensure data was returned before attempting
to treat it as an array.

Tested: API and command line calls for known subjects ('google.com') and
unknown subjects ('echo1234') with nolog on and nolog off. Confirmed no
exceptions.