Blank cursor creation error check

I've added required error check for null cursor creation.