NPE in DocAllocationHdr

Description

I was manually messing with my DB to try and fix some earlier manual messing with my DB. I created a situation that exposed a bug in the following code:

https://github.com/idempiere/idempiere/blob/dcd7d6a41e6b95851e75650bbd2e2f36ac5cdf2d/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java#L419-L423

There is an NPE vulnerability here. The code on line 421 anticipates and handles a situation where fl may be null. However, line 423 will NPE if fl is null.

Admittedly, this situation has arisen because I have fiddled with the database. So I don't know how likely this situation is to arise in the real-world. Nevertheless, it seems a bit untidy that on the one hand we are anticipating that fl might be null, and on the other hand assuming that it isn't.

Environment

Windows 10, Open JDK 11

Assignee

Carlos Ruiz

Reporter

Jeremy Krieg

Labels

None

Tested By

None

Components

Affects versions

Priority

Major
Configure