Skip to content

Fix segfault when ligands fail to parse in batch mode#181

Open
caic99 wants to merge 2 commits intodptech-corp:mainfrom
caic99:fix/empty-ligand-segfault-112
Open

Fix segfault when ligands fail to parse in batch mode#181
caic99 wants to merge 2 commits intodptech-corp:mainfrom
caic99:fix/empty-ligand-segfault-112

Conversation

@caic99
Copy link
Copy Markdown
Member

@caic99 caic99 commented Apr 10, 2026

Summary

  • Fixes run unidock, report segmentation fault while using file index #112: segfault (SIGSEGV) when using --ligand_index with ligands that fail to parse
  • parse_ligand_from_file_no_failure() returns an empty model (with empty ligands vector) when parsing fails, but main.cpp accesses ligands[0] without checking, causing a crash
  • Added a guard that checks for empty ligands vector before accessing it, skipping failed ligands with a warning instead of crashing

Test plan

  • Run Uni-Dock with --ligand_index containing a mix of valid and intentionally malformed ligand files
  • Verify that malformed ligands produce a warning message and are skipped gracefully
  • Verify that valid ligands in the same batch are still docked correctly

🤖 Generated with Claude Code

When using --ligand_index, ligands that fail to parse return an empty
model with an empty ligands vector. Accessing ligands[0] on that empty
vector causes a segfault. Add a guard to check for empty ligands and
skip them with a warning instead of crashing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@caic99 caic99 marked this pull request as ready for review April 20, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run unidock, report segmentation fault while using file index

1 participant