Crash on AssetTools.AdvancedCopyPackages

Hi, everyone!

A user is getting a crash running a plugin for the editor I did. Looking through the logs, this is the only info I get:

Script Stack (1 frames) :
/Script/WLS_Library.AssetUtility.AdvancedCopy

[2024.03.27-21.39.49:825][432]LogWindows: Error: appError called: Assertion failed: this [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp] [Line: 2229] 

Looking through the source code, this is the line causing the issue, apparently:

// If you're looking at this check it is due to calling IsChildOf with a this nullptr. *MAKE* sure you do not call this function
// with a this nullptr. It is undefined behavior, and some compilers, clang13 have started to optimize out this == nullptr checks.
check(this);

I tried running the same action on the same project on my machine but could not reproduce the crash. I don’t understand how trying to copy the same assets would be calling isChildOf with a nulptr on his machine but not on mine.

Obs: I also have the runtime-xml and dmp files from the crash, but could not gleam any useful information from it.

Have you experienced crashes using AdvancedCopy too? Any ideas on what could be causing it?

Thanks!

It’s hard to arrive at a conclusion with just the info you presented. For starters, you should probably generate and post a backtrace of the crash.

There’s a good chance it’s an issue on your side; given that, maybe you should also share your personal code snippet that might be ultimately leading that nullptr to materialize.