Page MenuHomeFeedback Tracker

NULL Pointer
Reviewed, UrgentPublic

Description

Hi,

So I am going to be honest with you, why release 1.17 without barely any fixes and no testing at all.
And you never even pushed a fix for exhaust smoke which was given and reported weeks before and scheduled for a fix but does not get fixed.

Why are you taking DayZ down the same route as H1Z1?

Anyway new problems raised alongside 1.17 updates

NULL pointer to instance
Class: 'MRAPPunisher'
Entity id:2951945

Function: 'BrakeLightsShineOff'
Stack trace:
Projects\Callatic_Vehicles_Armoured_Pack\scripts\4_World/entities\vehicles\inherited\mrappunisher.c:95
scripts/4_World/entities\vehicles\carscript.c:1396
scripts/4_World/entities\vehicles\carscript.c:1148
scripts/4_World/entities\vehicles\carscript.c:457
scripts/3_Game/entities\entityai.c:748
scripts/4_World/entities\itembase.c:1809
scripts/4_World/entities\core\inherited\inventoryitem.c:262

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce
  1. Set up that a vehicle contains a override BrakeLightsShineOff and On via the .c script
  2. Watch the crash log be spammed with NULL Pointers but no server crash or client crash

Used code that produced these crashes:

	override void BrakeLightsShineOff()
	{
		string material = ConfigGetString("BrakeReflectorMatOff");
		
		if (material != "")
		{
			SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_L, material);
			SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_R, material);
			int brakelight_1_2 = FindAttachmentBySlotName("MRAPPunisher_Cargo3").GetHiddenSelectionIndex("light_brake_1_2");
			int brakelight_2_2 = FindAttachmentBySlotName("MRAPPunisher_Cargo4").GetHiddenSelectionIndex("light_brake_2_2");
			FindAttachmentBySlotName("MRAPPunisher_Cargo3").SetObjectMaterial( brakelight_1_2, material );
			FindAttachmentBySlotName("MRAPPunisher_Cargo4").SetObjectMaterial( brakelight_2_2, material );
		}
	}

	override void BrakeLightsShineOn()
	{
		string material = ConfigGetString("BrakeReflectorMatOn");
		
		if (material != "")
		{
			SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_L, material);
			SetObjectMaterial(SELECTION_ID_BRAKE_LIGHT_R, material);
			if( FindAttachmentBySlotName("MRAPPunisher_Cargo3") )
			if( FindAttachmentBySlotName("MRAPPunisher_Cargo4") )
			{
			int brakelight_1_2 = FindAttachmentBySlotName("MRAPPunisher_Cargo3").GetHiddenSelectionIndex("light_brake_1_2");
			int brakelight_2_2 = FindAttachmentBySlotName("MRAPPunisher_Cargo4").GetHiddenSelectionIndex("light_brake_2_2");
			FindAttachmentBySlotName("MRAPPunisher_Cargo3").SetObjectMaterial( brakelight_1_2, material );
			FindAttachmentBySlotName("MRAPPunisher_Cargo4").SetObjectMaterial( brakelight_2_2, material );
			}
		}
	}

Event Timeline

Callatic created this task.Apr 20 2022, 9:20 PM
Geez changed the task status from New to Reviewed.Apr 21 2022, 10:38 AM
Geez added a subscriber: Geez.

Hello Callatic.
The null pointers occur because the code you are using is not correct.
In BrakeLightsShineOn() you are checking for existance of "MRAPPunisher_Cargo3" and "MRAPPunisher_Cargo3" , in BrakeLightsShineOff() it is not checked.
Regards,
Geez

Hi,

So if I make both functions check for the existence of MRAPPunisher_Cargo3 and MRAPPunisherCargo4 it should not imprint any null pointer?

Thanks,
Callum