check for errors

This commit is contained in:
rusefillc 2024-03-22 21:21:57 -04:00
parent 00cc0c0a39
commit ce7e635291
1 changed files with 3 additions and 2 deletions

View File

@ -99,8 +99,9 @@ public class DbcFile {
private void purgePacket(DbcPacket currentPacket) {
if (currentPacket != null) {
if (packets.containsKey(currentPacket.getId()))
throw new IllegalStateException("We already have " + packets.get(currentPacket.getId()).getName() + " for " + currentPacket.getId());
DbcPacket existingPacket = packets.get(currentPacket.getId());
if (existingPacket != null && existingPacket != currentPacket)
throw new IllegalStateException("We already have " + existingPacket.getName() + " for " + currentPacket.getId());
packets.put(currentPacket.getId(), currentPacket);
}
}