(bug 43786) Fix query error when there no orgs to select on

Change-Id: I1ec86f94061a92ed320e0b08e4188332d5040670
Merge "(bug 43786) Fix query error when there no orgs to select on"