Added a check that the quantity property is set on the basket item object before trying to reference it.