Skip to content

Commit a743e5b

Browse files
committed
maybe finally putting to bed the NRE on prop batcher destroy
1 parent 5235126 commit a743e5b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

RasterPropMonitor/Auxiliary modules/PropBatcher.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ class LabelBatch
210210

211211
public List<JSITextMesh> textMeshes = new List<JSITextMesh>();
212212
public bool needsUpdate = true;
213-
214213

215214
public LabelBatch(JSILabel firstLabel)
216215
{
@@ -291,12 +290,14 @@ public void LateUpdate()
291290
}
292291

293292
readonly Dictionary<JSILabel.TextBatchInfo, LabelBatch> labelBatches = new Dictionary<JSILabel.TextBatchInfo, LabelBatch>();
293+
RasterPropMonitorComputer rpmComp = null;
294294

295295
public void AddStaticLabel(JSILabel label)
296296
{
297297
LabelBatch labelBatch;
298298
if (!labelBatches.TryGetValue(label.batchInfo, out labelBatch))
299299
{
300+
rpmComp = label.rpmComp;
300301
labelBatch = new LabelBatch(label);
301302
labelBatches.Add(label.batchInfo, labelBatch);
302303
// TODO: hook up flashing behavior
@@ -329,9 +330,8 @@ void LateUpdate()
329330

330331
void OnDestroy()
331332
{
332-
if (labelBatches.Count > 0)
333+
if (rpmComp != null)
333334
{
334-
RasterPropMonitorComputer rpmComp = RasterPropMonitorComputer.FindFromProp(internalProp);
335335
foreach (var labelBatch in labelBatches)
336336
{
337337
if (labelBatch.Key.variableName != null)

0 commit comments

Comments
 (0)