Skip to content

Commit f14e5d0

Browse files
Add preventive check in filter interface against non-existent KSP interface during loading
1 parent a20ad38 commit f14e5d0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/RemoteTech/UI/FilterOverlay.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ private Rect Position
7878
mImg = obj.GetChild("bg (stretch)").GetComponent<UnityEngine.UI.Image>();
7979
}
8080

81-
posX = mImg.rectTransform.rect.width * GameSettings.UI_SCALE;
81+
if (mImg != null)
82+
{
83+
posX = mImg.rectTransform.rect.width * GameSettings.UI_SCALE;
84+
}
8285
}
8386

8487
return new Rect(posX, posY, mTextures.Background.width * GameSettings.UI_SCALE, mTextures.Background.height * GameSettings.UI_SCALE);
@@ -104,7 +107,11 @@ private Rect PositionSatellite
104107
if(obj != null)
105108
mImg = obj.GetChild("bg (stretch)").GetComponent<UnityEngine.UI.Image>();
106109
}
107-
posX = mImg.rectTransform.rect.width * GameSettings.UI_SCALE;
110+
111+
if (mImg != null)
112+
{
113+
posX = mImg.rectTransform.rect.width * GameSettings.UI_SCALE;
114+
}
108115
}
109116

110117
return new Rect(posX, Screen.height - height, width, height);

0 commit comments

Comments
 (0)