Fixing NullPointerException caused by having a mix of valid Groups and NULLs inside the result of getGroupsFromKeys