autotest: tko/db: fix get_child_tests_by_parent if no results exist

BUG=chromium:966518
TEST=None

Change-Id: I9fa49c3d623b446ca54423424e26ed4ddbd44923
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1626183
Tested-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Alex Zamorzaev <zamorzaev@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
diff --git a/tko/db.py b/tko/db.py
index 96540fe..b4c5aa4 100644
--- a/tko/db.py
+++ b/tko/db.py
@@ -850,6 +850,8 @@
         rows = self.select('tko_job_idx', 'tko_task_references',
                            {'parent_task_id': parent_task_id})
         tko_job_ids = [str(r[0]) for r in rows]
+        if not tko_job_ids:
+            return []
         fields = ['test_name', 'status']
         where = 'job_idx in (%s)' % ', '.join(tko_job_ids)
         rows = self.select(', '.join(fields), 'tko_test_view_2', where)