File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,8 +54,13 @@ ResourceManager::FindTexture(const std::string_view path) {
5454
5555void ResourceManager::CreateTexture (const std::string_view path) {
5656 std::shared_ptr<Texture> texture = std::make_shared<Texture>();
57- texture->SetTexture (IMG_LoadTexture (m_renderer.GetSDLRenderer (),
58- std::string (path).c_str ()));
57+ SDL_Texture *sdlTex =
58+ IMG_LoadTexture (m_renderer.GetSDLRenderer (), std::string (path).c_str ());
59+ if (sdlTex == nullptr ) {
60+ // TODO: add logging here
61+ return ;
62+ }
63+ texture->SetTexture (sdlTex);
5964 m_textureMap.emplace (path, std::move (texture));
6065}
6166
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ Texture::~Texture() {
99 }
1010}
1111void Texture::SetTexture (SDL_Texture *texture) {
12+ if (texture == nullptr ) {
13+ // TODO: add logging here
14+ return ;
15+ }
1216 m_texture = texture;
1317 m_width = m_texture->w ;
1418 m_height = m_texture->h ;
You can’t perform that action at this time.
0 commit comments