Skip to content

Commit

Permalink
avoid NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Nov 21, 2017
1 parent 3f05ecc commit 6581b86
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import de.metas.ui.web.quickinput.QuickInputLayoutDescriptor;
import de.metas.ui.web.window.datatypes.DocumentId;
import de.metas.ui.web.window.datatypes.DocumentType;
import de.metas.ui.web.window.datatypes.LookupValue;
import de.metas.ui.web.window.datatypes.LookupValue.IntegerLookupValue;
import de.metas.ui.web.window.descriptor.DetailId;
import de.metas.ui.web.window.descriptor.DocumentEntityDescriptor;
Expand Down Expand Up @@ -134,7 +135,13 @@ private static void onProductChangedCallout(final ICalloutField calloutField)
}

final IOrderLineQuickInput quickInputModel = quickInput.getQuickInputDocumentAs(IOrderLineQuickInput.class);
final ProductAndAttributes productAndAttributes = ProductLookupDescriptor.toProductAndAttributes(quickInputModel.getM_Product_ID());
final LookupValue productLookupValue = quickInputModel.getM_Product_ID();
if(productLookupValue == null)
{
return;
}

final ProductAndAttributes productAndAttributes = ProductLookupDescriptor.toProductAndAttributes(productLookupValue);
final I_M_Product quickInputProduct = load(productAndAttributes.getProductId(), I_M_Product.class);

final I_C_Order order = quickInput.getRootDocumentAs(I_C_Order.class);
Expand Down

0 comments on commit 6581b86

Please sign in to comment.