VCards in SOGo are represented without trailing newlines after END:VCARD
kcontacts parser doesn't expect this and on reaching "END:VCARD" text.indexOf('\n', lineStart) will return '-1' and that breaks 'for' loop.
Fixed behavior: if text.indexOf('\n', lineStart) returns -1 [there are no more newlines] lineEnd will be set to the returned value of text.size()