Dear Friends at Epic,
A community member is reporting that an Android packaging attempt is failing where the same exact C++ code succeeds when packaged for windows!
#The Errors
Projects\MyProject\Plugins\VictoryPlugin\Source\VictoryBPLibrary\Private\VictoryBPFunctionLibrary.cpp(902,18) : error: initialization of pointer of type 'AActor *' to null from a constant boolean expression [-Werror,-Wbool-conversion]
if (!Itr) return false;
^~~~~
C:\Users\Desktop\Documents\Unreal Projects\MyProject\Plugins\VictoryPlugin\Source\VictoryBPLibrary\Private\VictoryBPFunctionLibrary.cpp(908,23) : error: initialization of pointer of type 'AActor *' to null from a constant boolean expression [-Werror,-Wbool-conversion]
if (!TheWorld) return false;
^~~~~
C:\Users\Desktop\Documents\Unreal Projects\MyProject\Plugins\VictoryPlugin\Source\VictoryBPLibrary\Private\VictoryBPFunctionLibrary.cpp(1014,18) : error: initialization of pointer of type 'AActor *' to null from a constant boolean expression [-Werror,-Wbool-conversion]
if (!Itr) return false;
^~~~~
C:\Users\Desktop\Documents\Unreal Projects\MyProject\Plugins\VictoryPlugin\Source\VictoryBPLibrary\Private\VictoryBPFunctionLibrary.cpp(1020,23) : error: initialization of pointer of type 'AActor *' to null from a constant boolean expression [-Werror,-Wbool-conversion]
if (!TheWorld) return false;
^~~~~
The code
In every case it is equality tests using the ObjectIterator in the following code that is not succeeding on Android build:
//Get a PC to GetWorld() from
TObjectIterator<APlayerController> Itr;
if (Itr == nullptr) return false;
//~~~~~~~~~~~~
//Get World
UWorld* TheWorld = Itr->GetWorld();
if (TheWorld == nullptr) return false;
//~~~~~~~~~~~~~~~~~
I understand that I can use a hidden WorldContext to get around this for BP nodes, and I do that in other nodes (more recent ones)
#The Issue
But what is concerning to me is that the android build is failing on a line that doesn’t seem android specific and has more to do with the definitions of the ObjectIterator’s iterator!
Any ideas?
Rama