FALCON-940 Avoid NPE in getAllEntitiesOfOneType() for zero elements. Contributed by Ruslan Ostafiychuk