Handle the indexerror exception on create_order

LMS-2646
Not valid javascript