From a1668b6f88e768565aa4558712728d952ded7049 Mon Sep 17 00:00:00 2001 From: MatCat Date: Tue, 2 Mar 2021 14:10:15 -0800 Subject: [PATCH] 0.3.3: Fixed crashing bug when an IC is placed with no inputs --- README.md | 4 ++++ js/elements.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fa7ced..dc22e1d 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ To be decided, but at this moment this code is open source and free to use for n ## Changelog +### 0.3.3 + +* Fixed a bug that crashed the engine when attempting to place an IC with no inputs + ### 0.3.2 * Added IC Element, allows for converting a logic design to an IC for use in designs. diff --git a/js/elements.js b/js/elements.js index 53b78a2..74b6fd6 100644 --- a/js/elements.js +++ b/js/elements.js @@ -679,7 +679,8 @@ class ICElement extends Element { if ((mouseDist <= (this.outputCircleRadius)) && !this.LogicEngine.ActiveLink) ctx.fillStyle = circleColorHover; ctx.fill(); ctx.stroke(); - let textSize = this.textSize(ctx,this.InputConnections[a].toElement.Properties[0].CurrentValue,"10px Console"); + let textSize = false; + if (ctx,this.InputConnections[a]) textSize = this.textSize(ctx,this.InputConnections[a].toElement.Properties[0].CurrentValue,"10px Console"); this.drawText(ctx,(x+(this.Width-10)) - (textSize.width + 5 + (this.outputCircleRadius*2)),(firstY + (a*24)) + 5,this.Outputs[a].fromElement.Properties[0].CurrentValue,"10px Console","#000"); } ctx.restore();