Fix bug in scala cogroup.flatMap

Did fail with null pointer exception when one of the inputs is empty.