SmoothZoom icon indicating copy to clipboard operation
SmoothZoom copied to clipboard

Unprotected nullprt

Open Beerbill opened this issue 7 years ago • 2 comments

Hello, firstly i'd like to thank you for making this amazing plugin!

I was able to update it for the 4.21 version but i was having a issue where the game would suddenly crash, by searching your code i was able to identify the problem:

in your AC_SmoothZoom.h is unprotected: class USpringArmComponent* SpringArm;

It should be like this to improve stability: UPROPERTY() class USpringArmComponent* SpringArm = nullptr;

And what was actually causing the crash was because i didn't setup it correctly before starting and your tick event was calling the null pointer, what can be done do fix it is:

in your AC_SmoothZoom.cpp in the tick component definition, you can include a ensure to prevent the calling of a nullptr:

Super::TickComponent(DeltaTime, TickType, ThisTickFunction); if (!ensure(SpringArm)) { return; };

This worked like a charm, i would pull request but i don't know how to use Git well, so hopefully it may help someone else.

Thanks again

Beerbill avatar Feb 28 '19 00:02 Beerbill

Thanks! This was never an issue on earlier versions. I've not maintained this for quite some time, I should re-visit this and make sure it works well even on 4.22.

All the best!

teak421 avatar Feb 28 '19 02:02 teak421

Added nullprt check.

teak421 avatar Mar 31 '19 21:03 teak421