I would get rlist quite the same way. This is what I have - no crashes, though I don't iterate over the atoms quite like you do:
vector<OBRing*> vr = mol.GetSSSR(); for (vector<OBRing*>::iterator iter = vr.begin(); iter != vr.end(); iter++) { num_rings++; if ((*iter)->IsAromatic()) num_aromatic++; if ((*iter)->Size() < 8) Num_Rings[(*iter)->Size()]++; } On Fri, 2012-05-04 at 19:30 -0400, Craig James wrote: > Can anyone tell me why this code crashes? It's copied almost verbatim > from the OpenBabel OBRing API page. > > Note: I wasn't sure if the "mol->GetSSSR()" call was needed before > calling mol->GetData("RingList"), so I added it to be sure. The man > page wasn't clear about this. > > Thanks, > Craig > > mol->GetSSSR(); > > vector<OBRing*>::iterator ri; > vector<int>::iterator j; > vector<OBRing*> *rlist = (vector<OBRing*>*)mol->GetData("RingList"); > for (ri = rlist->begin(); ri != rlist->end(); ++ri) { > > for (j = (*ri)->_path.begin(); j != (*ri)->_path.end(); ++j ) { > OBAtom *atom = mol->GetAtom(*j); // <<<<<===== crashes > here, pointer j is NULL > ... > } > } ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel