Skip to content

Commit

Permalink
Merged 'ISSUE-31' into 'dev'.
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-Apps committed Jul 6, 2018
2 parents 5095363 + d71b30a commit 5594822
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ParallelRoadTool/ModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace ParallelRoadTool
{
public class ModInfo : IUserMod
{
public const string Version = "0.17.0";
public const string Version = "0.19.0";
public const string Branch = "dev";

public ModInfo()
Expand Down
32 changes: 19 additions & 13 deletions ParallelRoadTool/ParallelRoadTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ParallelRoadTool : MonoBehaviour
private bool _isToolActive;
public bool IsToolActive
{
get => _isToolActive && NetTool.enabled;
get => _isToolActive && NetTool != null && NetTool.enabled;

private set
{
Expand Down Expand Up @@ -168,18 +168,24 @@ public void Start()

public void OnDestroy()
{
DebugUtils.Log("Destroying ...");

UnsubscribeToUIEvents();
AvailableRoadTypes.Clear();
SelectedRoadTypes.Clear();
IsToolActive = false;
IsSnappingEnabled = false;
IsLeftHandTraffic = false;
_mainWindow.OnDestroy();
_mainWindow = null;

NetManagerDetour.Revert();
try
{
DebugUtils.Log("Destroying ...");

NetManagerDetour.Revert();

UnsubscribeToUIEvents();
AvailableRoadTypes.Clear();
SelectedRoadTypes.Clear();
IsToolActive = false;
IsSnappingEnabled = false;
IsLeftHandTraffic = false;
_mainWindow.OnDestroy();
_mainWindow = null;
}
catch {
// HACK - [ISSUE 31]
}
}

public void OnGUI()
Expand Down
10 changes: 8 additions & 2 deletions ParallelRoadTool/UI/UIMainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,14 @@ public override void Update()

public override void OnDestroy()
{
UnsubscribeToUIEvents();
base.OnDestroy();
try
{
UnsubscribeToUIEvents();
base.OnDestroy();
}
catch {
// HACK - [ISSUE-31]
}
}

protected override void OnPositionChanged()
Expand Down

0 comments on commit 5594822

Please sign in to comment.