Move BinaryMessage isFull() check into try block to prevent NPE. (#881)

From issue 879:
When a BitSetFullException is caught and reset(0) is called, the
BinaryMessage is set to null.

This should resolve issue 879.
This commit is contained in:
Noah Lynch
2020-07-25 06:59:13 -04:00
committed by GitHub
parent e07d6fa854
commit 207893e5a8

View File

@@ -201,14 +201,6 @@ public class P25P1MessageFramer implements Listener<Dibit>, IP25P1DataUnitDetect
{ {
mBinaryMessage.add(dibit.getBit1()); mBinaryMessage.add(dibit.getBit1());
mBinaryMessage.add(dibit.getBit2()); mBinaryMessage.add(dibit.getBit2());
}
catch(BitSetFullException bsfe)
{
// mLog.debug("Message full exception - unexpected");
//Reset so that we can start over again
reset(0);
}
if(mBinaryMessage.isFull()) if(mBinaryMessage.isFull())
{ {
@@ -221,6 +213,14 @@ public class P25P1MessageFramer implements Listener<Dibit>, IP25P1DataUnitDetect
dispatchMessage(); dispatchMessage();
} }
} }
catch(BitSetFullException bsfe)
{
// mLog.debug("Message full exception - unexpected");
//Reset so that we can start over again
reset(0);
}
}
else else
{ {
//Suppress any trailing nulls or status dibits that follow certain DUID sequences //Suppress any trailing nulls or status dibits that follow certain DUID sequences