Fixed nullpointerexception when inserting into empty adapter. Fixes #178.