On Wednesday, October 25, 2023 6:22:54 PM EDT Donna Whisnant wrote: > David, > > Based on the code you are showing, I can pretty much guarantee you that your > segfault is caused by tempMod being a null pointer -- i.e. that the value > of the map element you are iterating is null.
Ok, I didn't know that there could be null elements in the map. > Your code needs to be more defensive and check if tempMod is a nullptr > before dereferencing it. Adding an 'if' around that code block should fix > your segfault problem. > But you'll have to determine why some module > entries in your map are nulls -- perhaps you missed loading modules or > something? Your code snippet doesn't show any of those details... it only > shows iterating something that appears to be a std::map. Do you have to do something to load modules? When my program initializes, I do this swordLibrary = new sword::SWMgr(new sword::MarkupFilterMgr(sword::FMT_PLAIN)); and then pass a pointer to that around my various classes. In this particular function, the iterator is this, sword::ModMap::iterator libraryIterator; I had thought I was following one of the examples.
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page