From 112481f4d877bf00ade03c872eca96c5a2b104ff Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Wed, 7 Oct 2026 11:12:19 -0600 Subject: [PATCH 1/6] macOS fix attempt 1 --- Harbour/include/utils/FileManager.h | 3 ++ Harbour/src/App.cpp | 18 +++++++-- Harbour/src/GameCard.cpp | 4 +- Harbour/src/main.cpp | 4 +- Harbour/src/utils/FileManager.cpp | 58 ++++++++++++++++++++++------ Harbour/src/utils/NetworkManager.cpp | 7 ++-- 6 files changed, 74 insertions(+), 20 deletions(-) diff --git a/Harbour/include/utils/FileManager.h b/Harbour/include/utils/FileManager.h index d415063..a428af1 100644 --- a/Harbour/include/utils/FileManager.h +++ b/Harbour/include/utils/FileManager.h @@ -8,6 +8,9 @@ namespace fs = std::filesystem; namespace HarbourUtils { + const fs::path resolvePath(const fs::path &path); + const fs::path resolvePath(const std::string &path); + class FileManager { public: diff --git a/Harbour/src/App.cpp b/Harbour/src/App.cpp index c891ab2..503428d 100644 --- a/Harbour/src/App.cpp +++ b/Harbour/src/App.cpp @@ -56,7 +56,11 @@ void Harbour::App::init() ImGui::CreateContext(); ImGuiIO &io = ImGui::GetIO(); - ImFont *font = io.Fonts->AddFontFromFileTTF("assets/Fonts/montserrat/Montserrat-Regular.otf", 16.0f); + auto fontFilePath = HarbourUtils::resolvePath(L"assets/Fonts/montserrat/Montserrat-Regular.otf"); + + std::cout << fontFilePath << std::endl; + + ImFont *font = io.Fonts->AddFontFromFileTTF(fontFilePath.string().c_str(), 16.0f); if (font == nullptr) io.Fonts->AddFontDefault(); @@ -182,7 +186,9 @@ void Harbour::App::drawSplashScreen() if (!m_splashImg) { int width = 0, height = 0; - LoadTextureFromFile("assets/GameCard/UnknownTitle.png", &m_splashImg, &width, &height); + auto filepath = HarbourUtils::resolvePath(L"assets/GameCard/UnknownTitle.png"); + std::cout << filepath << std::endl; + LoadTextureFromFile(filepath.string().c_str(), &m_splashImg, &width, &height); } ImGui::Image((ImTextureID)(intptr_t)m_splashImg, ImVec2(256, 256)); @@ -232,10 +238,16 @@ std::string Harbour::App::updateMessage() void Harbour::App::initAppClasses() { + std::cout << "Thread started" << std::endl; m_fileManager = std::make_unique(); + std::cout << "FileManager" << std::endl; m_networkManager = std::make_unique(m_fileManager.get()); + std::cout << "NetworkManager" << std::endl; m_libraryManager = std::make_unique(m_fileManager.get()); + std::cout << "LibraryManager" << std::endl; - m_allGames = m_libraryManager->constructLibraryFromJSON("cache/manifest.json"); + auto manifestResolvedPath = HarbourUtils::resolvePath(L"cache/manifest.json"); + std::cout << manifestResolvedPath << std::endl; + m_allGames = m_libraryManager->constructLibraryFromJSON(manifestResolvedPath.string()); m_initComplete.store(true); } diff --git a/Harbour/src/GameCard.cpp b/Harbour/src/GameCard.cpp index 98553d8..2bb82e7 100644 --- a/Harbour/src/GameCard.cpp +++ b/Harbour/src/GameCard.cpp @@ -1,5 +1,6 @@ #include "GameCard.h" #include +#include "utils/FileManager.h" Harbour::GameCard::GameCard() { @@ -42,7 +43,8 @@ void Harbour::GameCard::setFilePath(const std::string &path) void Harbour::GameCard::setThumbnailImg(const std::string &path) { - m_thumbnailFilePath = path; + auto rPath = HarbourUtils::resolvePath(path); + m_thumbnailFilePath = rPath.string(); } bool Harbour::GameCard::startGame() diff --git a/Harbour/src/main.cpp b/Harbour/src/main.cpp index 2eb7e13..4875907 100644 --- a/Harbour/src/main.cpp +++ b/Harbour/src/main.cpp @@ -3,10 +3,10 @@ // main.cpp #define SDL_MAIN_HANDLED - #include "App.h" -int main() { +int main(int argc, char **argv) +{ Harbour::App app = {}; app.run(); diff --git a/Harbour/src/utils/FileManager.cpp b/Harbour/src/utils/FileManager.cpp index 3d72eb7..fc24052 100644 --- a/Harbour/src/utils/FileManager.cpp +++ b/Harbour/src/utils/FileManager.cpp @@ -4,6 +4,12 @@ #include #include +#if defined(__APPLE__) +#include +#include +#include +#endif + HarbourUtils::FileManager::FileManager() { this->directoryExists("cache/downloads", true); // Creates cache/downloads/ folder for downloaded archives to be put in @@ -14,19 +20,16 @@ HarbourUtils::FileManager::~FileManager() { } -HarbourUtils::FileManager *HarbourUtils::FileManager::get() -{ - return this; -} - void HarbourUtils::FileManager::saveConfigFile(const nlohmann::json &config, const fs::path &path) { - if (!path.parent_path().empty() && !fs::exists(path.parent_path())) + fs::path rPath = HarbourUtils::resolvePath(path); + + if (!rPath.parent_path().empty() && !fs::exists(rPath.parent_path())) { - fs::create_directories(path.parent_path()); + fs::create_directories(rPath.parent_path()); } - std::ofstream stream(path, std::ios::out | std::ios::trunc); + std::ofstream stream(rPath, std::ios::out | std::ios::trunc); if (stream.is_open()) { stream << config.dump(4); @@ -40,9 +43,10 @@ void HarbourUtils::FileManager::saveConfigFile(const nlohmann::json &config, con nlohmann::json HarbourUtils::FileManager::loadConfigFile(const fs::path &path) { + fs::path rPath = HarbourUtils::resolvePath(path); try { - std::ifstream stream(path); + std::ifstream stream(rPath); if (stream.is_open()) { nlohmann::json config; @@ -73,7 +77,9 @@ bool HarbourUtils::FileManager::fileExists(const fs::path &path) bool HarbourUtils::FileManager::directoryExists(const fs::path &path, bool createIfMissing) { - if (fs::exists(path) && fs::is_directory(path)) + fs::path rPath = HarbourUtils::resolvePath(path); + + if (fs::exists(rPath) && fs::is_directory(rPath)) { return true; } @@ -81,7 +87,8 @@ bool HarbourUtils::FileManager::directoryExists(const fs::path &path, bool creat { if (createIfMissing) { - fs::create_directories(path); + fs::create_directories(rPath); + return true; } return false; } @@ -96,6 +103,35 @@ bool HarbourUtils::FileManager::unzipArchive(const fs::path &path, const fs::pat return true; } +const fs::path HarbourUtils::resolvePath(const fs::path &path) +{ + // Assisted by Gemini 3.1 Pro Extended because I am still learning macOS specific fixes +#if defined(__APPLE__) + char appPath[PATH_MAX]; + uint32_t size = sizeof(appPath); + + if (_NSGetExecutablePath(appPath, &size) == 0) + { + char realPath[PATH_MAX]; + if (realpath(appPath, realPath) != nullptr) + { + fs::path resolvedPath(realPath); + return resolvedPath.parent_path(); // just the directory the app is actually in + } + } +#endif + return fs::weakly_canonical(path); + // return fs::current_path(); +} + +const fs::path HarbourUtils::resolvePath(const std::string &pathStr) +{ + + fs::path path = fs::path(pathStr); + fs::path resolvedPath = resolvePath(path); + return resolvedPath; +} + /** * Placeholder code #include diff --git a/Harbour/src/utils/NetworkManager.cpp b/Harbour/src/utils/NetworkManager.cpp index d7425a0..cda96e6 100644 --- a/Harbour/src/utils/NetworkManager.cpp +++ b/Harbour/src/utils/NetworkManager.cpp @@ -25,7 +25,8 @@ HarbourUtils::NetworkManager *HarbourUtils::NetworkManager::get() void HarbourUtils::NetworkManager::checkForManifestUpdate() { - nlohmann::json etags = m_fileManager->loadConfigFile("cache/etags.json"); + auto cachePath = HarbourUtils::resolvePath(L"cache/etags.json"); + nlohmann::json etags = m_fileManager->loadConfigFile(cachePath); cpr::Header headers = { {"Expect", ""}}; @@ -53,12 +54,12 @@ void HarbourUtils::NetworkManager::checkForManifestUpdate() if (!manifestETag.empty()) { etags["manifest"] = manifestETag; - m_fileManager->saveConfigFile(etags, "cache/etags.json"); + m_fileManager->saveConfigFile(etags, cachePath); } nlohmann::json manifest = nlohmann::json::parse(r.text); - m_fileManager->saveConfigFile(manifest, "cache/manifest.json"); + m_fileManager->saveConfigFile(manifest, HarbourUtils::resolvePath(L"cache/manifest.json")); } void HarbourUtils::NetworkManager::checkForSelfUpdate() From b1aed4e6f875dac4f0aa30e7712a789a56a6c0a4 Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Wed, 7 Oct 2026 14:40:29 -0600 Subject: [PATCH 2/6] Actually return the path on macOS --- Harbour/include/utils/FileManager.h | 2 -- Harbour/src/App.cpp | 2 +- Harbour/src/utils/FileManager.cpp | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Harbour/include/utils/FileManager.h b/Harbour/include/utils/FileManager.h index a428af1..20e367c 100644 --- a/Harbour/include/utils/FileManager.h +++ b/Harbour/include/utils/FileManager.h @@ -17,8 +17,6 @@ namespace HarbourUtils FileManager(); ~FileManager(); - FileManager *get(); - void saveConfigFile(const nlohmann::json &config, const fs::path &path); nlohmann::json loadConfigFile(const fs::path &path); diff --git a/Harbour/src/App.cpp b/Harbour/src/App.cpp index 503428d..320c0ed 100644 --- a/Harbour/src/App.cpp +++ b/Harbour/src/App.cpp @@ -47,7 +47,7 @@ void Harbour::App::init() #endif m_window = SDL_CreateWindow("Harbour Ports", - 1280, 720, SDL_WINDOW_OPENGL); // Allow SDL_WINDOW_RESIZABLE? + 1280, 720, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); // Allow SDL_WINDOW_RESIZABLE? SDL_GLContext gl_context = SDL_GL_CreateContext(m_window); gladLoadGLLoader((GLADloadproc)SDL_GL_GetProcAddress); diff --git a/Harbour/src/utils/FileManager.cpp b/Harbour/src/utils/FileManager.cpp index fc24052..f5f6882 100644 --- a/Harbour/src/utils/FileManager.cpp +++ b/Harbour/src/utils/FileManager.cpp @@ -116,12 +116,11 @@ const fs::path HarbourUtils::resolvePath(const fs::path &path) if (realpath(appPath, realPath) != nullptr) { fs::path resolvedPath(realPath); - return resolvedPath.parent_path(); // just the directory the app is actually in + return resolvedPath.parent_path() / path; // just the directory the app is actually in } } #endif return fs::weakly_canonical(path); - // return fs::current_path(); } const fs::path HarbourUtils::resolvePath(const std::string &pathStr) From 44d65912344a0710020abfcf469a044e1eb9e659 Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Thu, 8 Oct 2026 18:22:09 -0600 Subject: [PATCH 3/6] Add verbose logging to image setup And remove old debugging statements --- Harbour/src/App.cpp | 8 -------- Harbour/src/GameCard.cpp | 8 ++++++-- Harbour/src/utils/LoadImage.cpp | 22 +++++++++++++++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Harbour/src/App.cpp b/Harbour/src/App.cpp index 320c0ed..4e9fb87 100644 --- a/Harbour/src/App.cpp +++ b/Harbour/src/App.cpp @@ -58,8 +58,6 @@ void Harbour::App::init() ImGuiIO &io = ImGui::GetIO(); auto fontFilePath = HarbourUtils::resolvePath(L"assets/Fonts/montserrat/Montserrat-Regular.otf"); - std::cout << fontFilePath << std::endl; - ImFont *font = io.Fonts->AddFontFromFileTTF(fontFilePath.string().c_str(), 16.0f); if (font == nullptr) io.Fonts->AddFontDefault(); @@ -187,7 +185,6 @@ void Harbour::App::drawSplashScreen() { int width = 0, height = 0; auto filepath = HarbourUtils::resolvePath(L"assets/GameCard/UnknownTitle.png"); - std::cout << filepath << std::endl; LoadTextureFromFile(filepath.string().c_str(), &m_splashImg, &width, &height); } @@ -238,16 +235,11 @@ std::string Harbour::App::updateMessage() void Harbour::App::initAppClasses() { - std::cout << "Thread started" << std::endl; m_fileManager = std::make_unique(); - std::cout << "FileManager" << std::endl; m_networkManager = std::make_unique(m_fileManager.get()); - std::cout << "NetworkManager" << std::endl; m_libraryManager = std::make_unique(m_fileManager.get()); - std::cout << "LibraryManager" << std::endl; auto manifestResolvedPath = HarbourUtils::resolvePath(L"cache/manifest.json"); - std::cout << manifestResolvedPath << std::endl; m_allGames = m_libraryManager->constructLibraryFromJSON(manifestResolvedPath.string()); m_initComplete.store(true); } diff --git a/Harbour/src/GameCard.cpp b/Harbour/src/GameCard.cpp index 2bb82e7..17caa9c 100644 --- a/Harbour/src/GameCard.cpp +++ b/Harbour/src/GameCard.cpp @@ -11,6 +11,8 @@ Harbour::GameCard::GameCard(std::string name, std::string version) std::cout << "A new Game Card was created!" << std::endl; this->setName(name); this->setVersion(version); + auto rThumbnailDefaultPath = HarbourUtils::resolvePath(m_thumbnailFilePath); + m_thumbnailFilePath = rThumbnailDefaultPath.string(); } Harbour::GameCard::~GameCard() @@ -38,12 +40,14 @@ void Harbour::GameCard::setLongDesc(const std::string &desc) void Harbour::GameCard::setFilePath(const std::string &path) { - m_executablePath = path; + auto rPath = HarbourUtils::resolvePath(path); + m_executablePath = rPath.string(); } void Harbour::GameCard::setThumbnailImg(const std::string &path) { auto rPath = HarbourUtils::resolvePath(path); + std::cout << "GameCard with name " << m_name << " just had its thumbnail path set to " << rPath << std::endl; m_thumbnailFilePath = rPath.string(); } @@ -97,5 +101,5 @@ void Harbour::GameCard::drawThumbnail() float widthOffset = ImGui::GetCursorPosX() + (m_size.x - m_thumbnailSize.x) / 2; ImGui::SetCursorPos(ImVec2(widthOffset, ImGui::GetCursorPosY())); - ImGui::Image((ImTextureID)(intptr_t)m_texture, ImVec2(256, 256)); // ImVec2(my_image_width, my_image_height) + ImGui::Image((ImTextureID)(intptr_t)m_texture, m_thumbnailSize); // ImVec2(my_image_width, my_image_height) } diff --git a/Harbour/src/utils/LoadImage.cpp b/Harbour/src/utils/LoadImage.cpp index cffd6a4..0a3375e 100644 --- a/Harbour/src/utils/LoadImage.cpp +++ b/Harbour/src/utils/LoadImage.cpp @@ -1,14 +1,15 @@ #define STB_IMAGE_IMPLEMENTATION #include "utils/LoadImage.h" +#include // Simple helper function to load an image into a OpenGL texture with common settings -bool LoadTextureFromMemory(const void* data, size_t data_size, GLuint* out_texture, int* out_width, int* out_height) +bool LoadTextureFromMemory(const void *data, size_t data_size, GLuint *out_texture, int *out_width, int *out_height) { // Load from file int image_width = 0; int image_height = 0; - unsigned char* image_data = stbi_load_from_memory((const unsigned char*)data, (int)data_size, &image_width, &image_height, NULL, 4); + unsigned char *image_data = stbi_load_from_memory((const unsigned char *)data, (int)data_size, &image_width, &image_height, NULL, 4); if (image_data == NULL) return false; @@ -17,6 +18,7 @@ bool LoadTextureFromMemory(const void* data, size_t data_size, GLuint* out_textu glGenTextures(1, &image_texture); glBindTexture(GL_TEXTURE_2D, image_texture); + std::cout << "[LoadTextureFromMemory] GLUint for this image is: " << image_texture << std::endl; // Setup filtering parameters for display glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -34,20 +36,30 @@ bool LoadTextureFromMemory(const void* data, size_t data_size, GLuint* out_textu } // Open and read a file, then forward to LoadTextureFromMemory() -bool LoadTextureFromFile(const char* file_name, GLuint* out_texture, int* out_width, int* out_height) +bool LoadTextureFromFile(const char *file_name, GLuint *out_texture, int *out_width, int *out_height) { - FILE* f = fopen(file_name, "rb"); + FILE *f = fopen(file_name, "rb"); + std::cout << "Opening image file at: " << file_name << std::endl; + if (f == NULL) + { + std::cout << "f is NULL" << std::endl; return false; + } + fseek(f, 0, SEEK_END); size_t file_size = (size_t)ftell(f); if (file_size == -1) return false; fseek(f, 0, SEEK_SET); - void* file_data = IM_ALLOC(file_size); + void *file_data = IM_ALLOC(file_size); fread(file_data, 1, file_size, f); fclose(f); + std::cout << "File " << file_name << " was successfully read and closed" << std::endl; + bool ret = LoadTextureFromMemory(file_data, file_size, out_texture, out_width, out_height); + + std::cout << "LoadTextureFromMemory succeeded" << std::endl; IM_FREE(file_data); return ret; } \ No newline at end of file From 5d2ef559395a7596fd106edaa8ed257cbd8fa7cc Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Sat, 10 Oct 2026 18:07:23 -0600 Subject: [PATCH 4/6] Safely set thumbnail paths on blank cards --- Harbour/include/GameCard.h | 2 +- Harbour/src/GameCard.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Harbour/include/GameCard.h b/Harbour/include/GameCard.h index 610542b..cdd86d0 100644 --- a/Harbour/include/GameCard.h +++ b/Harbour/include/GameCard.h @@ -31,7 +31,7 @@ namespace Harbour std::string m_longDesc = ""; - std::string m_thumbnailFilePath = "assets/GameCard/UnknownTitle.png"; + std::string m_thumbnailFilePath = ""; std::string m_executablePath = ""; bool m_owned = false; diff --git a/Harbour/src/GameCard.cpp b/Harbour/src/GameCard.cpp index 17caa9c..90f35e2 100644 --- a/Harbour/src/GameCard.cpp +++ b/Harbour/src/GameCard.cpp @@ -4,6 +4,7 @@ Harbour::GameCard::GameCard() { + this->setThumbnailImg("assets/GameCard/UnknownTitle.png"); } Harbour::GameCard::GameCard(std::string name, std::string version) @@ -11,8 +12,7 @@ Harbour::GameCard::GameCard(std::string name, std::string version) std::cout << "A new Game Card was created!" << std::endl; this->setName(name); this->setVersion(version); - auto rThumbnailDefaultPath = HarbourUtils::resolvePath(m_thumbnailFilePath); - m_thumbnailFilePath = rThumbnailDefaultPath.string(); + this->setThumbnailImg("assets/GameCard/UnknownTitle.png"); } Harbour::GameCard::~GameCard() @@ -89,7 +89,7 @@ void Harbour::GameCard::draw() void Harbour::GameCard::drawThumbnail() { - if (!m_texture) + if (!m_texture && !m_thumbnailFilePath.empty()) { // From ImGui docs by ocornut int my_image_width = 0; From 8cb256732deda1fb60cf4d2a4ac768ea763bab6d Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Sat, 10 Oct 2026 20:03:16 -0600 Subject: [PATCH 5/6] Final image fixes 1 --- Harbour/include/GameCard.h | 2 ++ Harbour/src/GameCard.cpp | 4 +++- Harbour/src/utils/LoadImage.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Harbour/include/GameCard.h b/Harbour/include/GameCard.h index cdd86d0..1aa6147 100644 --- a/Harbour/include/GameCard.h +++ b/Harbour/include/GameCard.h @@ -37,6 +37,8 @@ namespace Harbour private: GLuint m_texture = 0; + bool m_textureNeedsUpdate = true; + ImVec2 m_size = {300, 350}; ImVec2 m_thumbnailSize = {256, 256}; }; diff --git a/Harbour/src/GameCard.cpp b/Harbour/src/GameCard.cpp index 90f35e2..36ddf21 100644 --- a/Harbour/src/GameCard.cpp +++ b/Harbour/src/GameCard.cpp @@ -49,6 +49,7 @@ void Harbour::GameCard::setThumbnailImg(const std::string &path) auto rPath = HarbourUtils::resolvePath(path); std::cout << "GameCard with name " << m_name << " just had its thumbnail path set to " << rPath << std::endl; m_thumbnailFilePath = rPath.string(); + m_textureNeedsUpdate = true; } bool Harbour::GameCard::startGame() @@ -89,13 +90,14 @@ void Harbour::GameCard::draw() void Harbour::GameCard::drawThumbnail() { - if (!m_texture && !m_thumbnailFilePath.empty()) + if (m_textureNeedsUpdate) { // From ImGui docs by ocornut int my_image_width = 0; int my_image_height = 0; bool ret = LoadTextureFromFile(m_thumbnailFilePath.c_str(), &m_texture, &my_image_width, &my_image_height); IM_ASSERT(ret); + m_textureNeedsUpdate = false; } float widthOffset = ImGui::GetCursorPosX() + (m_size.x - m_thumbnailSize.x) / 2; diff --git a/Harbour/src/utils/LoadImage.cpp b/Harbour/src/utils/LoadImage.cpp index 0a3375e..9e91e21 100644 --- a/Harbour/src/utils/LoadImage.cpp +++ b/Harbour/src/utils/LoadImage.cpp @@ -14,8 +14,10 @@ bool LoadTextureFromMemory(const void *data, size_t data_size, GLuint *out_textu return false; // Create a OpenGL texture identifier - GLuint image_texture; - glGenTextures(1, &image_texture); + GLuint image_texture = (out_texture != nullptr) ? *out_texture : 0; + if (image_texture == 0) + glGenTextures(1, &image_texture); // only generate if it's never been generated before + glBindTexture(GL_TEXTURE_2D, image_texture); std::cout << "[LoadTextureFromMemory] GLUint for this image is: " << image_texture << std::endl; From c023256a73466bd14893f552c703d644b315285a Mon Sep 17 00:00:00 2001 From: ThatCodingFrog Date: Sun, 11 Oct 2026 18:02:12 -0600 Subject: [PATCH 6/6] A few more logs --- Harbour/src/GameCard.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Harbour/src/GameCard.cpp b/Harbour/src/GameCard.cpp index 36ddf21..e8badcb 100644 --- a/Harbour/src/GameCard.cpp +++ b/Harbour/src/GameCard.cpp @@ -47,7 +47,7 @@ void Harbour::GameCard::setFilePath(const std::string &path) void Harbour::GameCard::setThumbnailImg(const std::string &path) { auto rPath = HarbourUtils::resolvePath(path); - std::cout << "GameCard with name " << m_name << " just had its thumbnail path set to " << rPath << std::endl; + std::cout << "GameCard with name " << m_name << " just had its thumbnail path set to " << rPath << "when m_texture was: " << m_texture << std::endl; m_thumbnailFilePath = rPath.string(); m_textureNeedsUpdate = true; } @@ -97,7 +97,8 @@ void Harbour::GameCard::drawThumbnail() int my_image_height = 0; bool ret = LoadTextureFromFile(m_thumbnailFilePath.c_str(), &m_texture, &my_image_width, &my_image_height); IM_ASSERT(ret); - m_textureNeedsUpdate = false; + if (ret) + m_textureNeedsUpdate = false; } float widthOffset = ImGui::GetCursorPosX() + (m_size.x - m_thumbnailSize.x) / 2;