Compare commits

...

3 commits

Author SHA1 Message Date
27095ae6c7 Fix some crash on figure loading 2024-11-24 20:57:23 +01:00
8521e33d05 fix missing include 2024-11-24 20:44:59 +01:00
6998fb1e1e trying prevent crash at exit 2024-10-02 08:36:43 +02:00
4 changed files with 15 additions and 4 deletions

View file

@ -15,7 +15,7 @@ void FSkyPortalModule::ShutdownModule()
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
if (GEngine->GetEngineSubsystem<USkyPortalSubsystem>()) {
if (GEngine && GEngine->GetEngineSubsystem<USkyPortalSubsystem>()) {
GEngine->GetEngineSubsystem<USkyPortalSubsystem>()->Deinitialize();
}
}

View file

@ -206,7 +206,11 @@ uint8* USkyPortalIO::QueryBlock(uint8 FigureIndex, uint8 BlockIndex)
}
}
} while (write == false && (output[0] != 'Q' || (output[1] % 0x10 != FigureIndex && output[1] != 0x01) || output[2] != BlockIndex) && attempt < 10);
} while (write == false && output && (output[0] != 'Q' || (output[1] % 0x10 != FigureIndex && output[1] != 0x01) || output[2] != BlockIndex) && attempt < 10);
if (output == nullptr) {
UE_LOG(LogSkyportalIO, Error, TEXT("Query failed after %d attempts"), attempt);
return 0; // Return early if the loop failed to get valid output
}
UE_LOG(LogSkyportalIO, Verbose, TEXT("Querying block %d - success"), BlockIndex);
UE_LOG(LogSkyportalIO, VeryVerbose, TEXT("Data block %d = \n %s"), BlockIndex,*OutputToString(output));
return output;

View file

@ -71,6 +71,8 @@ void FPortalStatusChecker::CheckPortalStatus()
if (
//!FalsePositive() //filter conflicting infos
true) {
int32 figID = 0;
UFigureData* figData = NewObject<UFigureData>();
//FigureDataBlock FigureData;
switch (CurrentStatusData.StatusArray[i])
{
@ -78,8 +80,12 @@ void FPortalStatusChecker::CheckPortalStatus()
case EFigureStatus::PRESENT:
break;
case EFigureStatus::ADDED:
//figData = PortalHandleRef->ReadFigureBlocks(i);
subref->OnSkylanderAdded.Broadcast(00, i);
figData = PortalHandleRef->ReadFigureBlocks(i);
if (figData)
{
figID = figData->GetFigureID();
}
subref->OnSkylanderAdded.Broadcast(figID, i);
break;
case EFigureStatus::REMOVED:
subref->OnSkylanderRemoved.Broadcast(00, i);

View file

@ -1,5 +1,6 @@
#pragma once
#include "SkyPortalDefinitions.h"
#include "HAL/Runnable.h"