Fix OpenCS crash when drag and drop is used with unexpected data

Fixes bug #1543.