Skip to content

[Visual] Fix crash when texturename is not leading to a valid texture file#6075

Open
epernod wants to merge 2 commits into
sofa-framework:masterfrom
InfinyTech3D:inf_2026_05-fix_wrongtexturepath
Open

[Visual] Fix crash when texturename is not leading to a valid texture file#6075
epernod wants to merge 2 commits into
sofa-framework:masterfrom
InfinyTech3D:inf_2026_05-fix_wrongtexturepath

Conversation

@epernod
Copy link
Copy Markdown
Contributor

@epernod epernod commented Apr 8, 2026

everything is in the title, if d_texturename is not empty but the file doesn't exists there is some crash even if ImageIO is also doing the check...


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@epernod epernod added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request labels Apr 8, 2026
Comment thread Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp
Comment thread Sofa/Component/Visual/src/sofa/component/visual/VisualModelImpl.cpp
std::string textureFilename = d_texturename.getFullPath();
if (sofa::helper::system::DataRepository.findFile(textureFilename))
{
loadTexture(d_texturename.getFullPath());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
loadTexture(d_texturename.getFullPath());
loadTexture(textureFilename);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findFile return false when it is a full path, so this check is indeed wrong

if (SetDirectory::IsAbsolute(filename)) return false; // absolute file path

@epernod epernod added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fix Fix a bug pr: status wip Development in the pull-request is still in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants