fixes an multiple-load issue leading to NPE when adding empty generator

streams
This commit is contained in:
Eyck Jentzsch 2024-02-11 12:35:10 +01:00
parent 64cc09d207
commit 5f244dc03a
2 changed files with 3 additions and 3 deletions

View File

@ -239,9 +239,9 @@ public class FtrDbLoader implements IWaveformDbLoader {
long startTime = cborDecoder.readInt()*time_scale_factor; long startTime = cborDecoder.readInt()*time_scale_factor;
long endTime = cborDecoder.readInt()*time_scale_factor; long endTime = cborDecoder.readInt()*time_scale_factor;
TxGenerator gen = txGenerators.get(genId); TxGenerator gen = txGenerators.get(genId);
FtrTx scvTx = new FtrTx(txId, gen.stream.getId(), genId, startTime, endTime, blockId, blockOffset); TxStream stream = gen.stream;
FtrTx scvTx = new FtrTx(txId, stream.getId(), genId, startTime, endTime, blockId, blockOffset);
updateTransactions(txId, scvTx); updateTransactions(txId, scvTx);
TxStream stream = txStreams.get(gen.stream.getId());
if (scvTx.beginTime == scvTx.endTime) { if (scvTx.beginTime == scvTx.endTime) {
stream.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime)); stream.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime));
gen.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime)); gen.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime));

View File

@ -65,7 +65,7 @@ class TxGenerator extends AbstractTxStream {
*/ */
@Override @Override
public IEventList getEvents() { public IEventList getEvents() {
if(events.size()==0) { if(stream.events.size()==0) {
try { try {
List<byte[]> chunks = stream.getChunks(); List<byte[]> chunks = stream.getChunks();
int blockid = 0; int blockid = 0;