Fixed crash when html file is empty and when canvas fails to aprse

This commit is contained in:
antopilo
2024-09-16 21:42:35 -04:00
parent 7ed37d0bbb
commit c6a2d916a8
4 changed files with 31 additions and 19 deletions

View File

@@ -28,7 +28,7 @@ UIResource::UIResource(const std::string& path) :
canvas->uuid = this->ID;
canvas = CanvasParser::Get().Parse(canvas, FileSystem::RelativeToAbsolute(path));
if (!canvas)
if (canvas != nullptr)
{
canvas->SetInputManager(inputManager);
canvas->ComputeLayout(defaultSize);
@@ -37,7 +37,7 @@ UIResource::UIResource(const std::string& path) :
void UIResource::Tick()
{
if (canvas)
if (canvas != nullptr)
{
canvas->Tick();
}
@@ -50,7 +50,7 @@ void UIResource::Draw()
RenderCommand::SetClearColor({ 0, 0, 0, 0 });
RenderCommand::Clear();
if (canvas)
if (canvas != nullptr)
{
canvas->Draw();
}
@@ -61,7 +61,7 @@ void UIResource::Draw()
void UIResource::Resize(const Vector2& size)
{
framebuffer->QueueResize(size);
if (canvas)
if (canvas != nullptr)
{
canvas->ComputeLayout(size);
}
@@ -75,7 +75,7 @@ void UIResource::Reload()
}
canvas = CanvasParser::Get().Parse(canvas, FileSystem::RelativeToAbsolute(filePath));
if (canvas)
if (canvas != nullptr)
{
canvas->SetInputManager(inputManager);
canvas->ComputeLayout(framebuffer->GetSize());