Call to a member function getQuantity() on null