From 5f244dc03a54b24383bf0ddfb4ae8b118319cd3e Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 11 Feb 2024 12:35:10 +0100 Subject: [PATCH] fixes an multiple-load issue leading to NPE when adding empty generator streams --- .../src/com/minres/scviewer/database/ftr/FtrDbLoader.java | 4 ++-- .../src/com/minres/scviewer/database/ftr/TxGenerator.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java index 2735152..a257df0 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/FtrDbLoader.java @@ -239,9 +239,9 @@ public class FtrDbLoader implements IWaveformDbLoader { long startTime = cborDecoder.readInt()*time_scale_factor; long endTime = cborDecoder.readInt()*time_scale_factor; 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); - TxStream stream = txStreams.get(gen.stream.getId()); if (scvTx.beginTime == scvTx.endTime) { stream.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime)); gen.addEvent(new TxEvent(this, EventKind.SINGLE, txId, scvTx.beginTime)); diff --git a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java index 209eb1f..d6bf0fe 100644 --- a/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java +++ b/plugins/com.minres.scviewer.database.ftr/src/com/minres/scviewer/database/ftr/TxGenerator.java @@ -65,7 +65,7 @@ class TxGenerator extends AbstractTxStream { */ @Override public IEventList getEvents() { - if(events.size()==0) { + if(stream.events.size()==0) { try { List chunks = stream.getChunks(); int blockid = 0;