Fix bug with AddBond on garbage input - check before allocating

Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
This commit is contained in:
Geoff Hutchison
2026-05-19 11:19:04 -04:00
parent 3fc5a21746
commit 71d9b18e15
+1
View File
@@ -2561,6 +2561,7 @@ namespace OpenBabel
if (!bgn || !end)
{
obErrorLog.ThrowError(__FUNCTION__, "Unable to add bond - invalid atom index", obDebug);
delete bond;
return(false);
}
bond->Set(_nbonds,bgn,end,order,flags);