So I'm making a callout plugin, whenever there is a route enable already or blips which were not removed my plugin decides to crash LSPDFR, so I'm wondering how can I remove the routes that are already enabled or how I can prevent it from crashing.
OnCalloutAccepted();
// It gets to here and then crashes before it can log the Enabled route.
police.GetAttachedBlip().EnableRoute(System.Drawing.Color.Red);
Game.LogTrivial("Enabled route");
And yes the variable police and the blip does exist.
" police = new Vehicle("police", spawnpoint.Around(10f));"
" CalloutUtils.addBlip(police, System.Drawing.Color.Blue);"
RagePluginHook.log:
[01/03/2018 13:01:54.823] LSPD First Response: ==============================
[01/03/2018 13:01:54.823] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[01/03/2018 13:01:54.823] LSPD First Response: ------------------------------
[01/03/2018 13:01:54.823] LSPD First Response: Origin: Game fiber "CalloutManager".
[01/03/2018 13:01:54.823] LSPD First Response: ------------------------------
[01/03/2018 13:01:54.824] LSPD First Response: Exception type: System.NullReferenceException
[01/03/2018 13:01:54.824] LSPD First Response: Exception message: Object reference not set to an instance of an object.
[01/03/2018 13:01:54.824] LSPD First Response: ------------------------------
[01/03/2018 13:01:54.824] LSPD First Response: Inner exceptions:
[01/03/2018 13:01:54.825] LSPD First Response: ------------------------------
[01/03/2018 13:01:54.825] LSPD First Response: Stack trace:
[01/03/2018 13:01:54.826] LSPD First Response: at BCallouts.Callouts.PursuitAssistance.OnCalloutAccepted()
[01/03/2018 13:01:54.826] at ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:line 338
[01/03/2018 13:01:54.826] at ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:line 173
[01/03/2018 13:01:54.826] at Rage.GameFiber.Main()
[01/03/2018 13:01:54.826] LSPD First Response: ==============================