diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DataUnitDetector.java b/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DataUnitDetector.java index 274e0cd5..a2ba2ec8 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DataUnitDetector.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/phase1/P25P1DataUnitDetector.java @@ -1,23 +1,20 @@ /* + * ***************************************************************************** + * Copyright (C) 2014-2023 Dennis Sheirer * - * * ****************************************************************************** - * * Copyright (C) 2014-2020 Dennis Sheirer - * * - * * This program is free software: you can redistribute it and/or modify - * * it under the terms of the GNU General Public License as published by - * * the Free Software Foundation, either version 3 of the License, or - * * (at your option) any later version. - * * - * * This program is distributed in the hope that it will be useful, - * * but WITHOUT ANY WARRANTY; without even the implied warranty of - * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * * GNU General Public License for more details. - * * - * * You should have received a copy of the GNU General Public License - * * along with this program. If not, see - * * ***************************************************************************** + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * **************************************************************************** */ package io.github.dsheirer.module.decode.p25.phase1; @@ -493,6 +490,13 @@ public class P25P1DataUnitDetector implements Listener, ISyncDetectListen */ public void put(Dibit dibit) { + //Note: this check is necessary where the previous runnable was interrupted and left the buffer + //pointer pointing past the end of the array length. + if(mPointer >= mBuffer.length) + { + mPointer = 0; + } + mBuffer[mPointer++] = dibit; if(mPointer >= mBuffer.length)