[sword-devel] Crash when getting module type
Troy A. Griffitts
scribe at crosswire.org
Fri Oct 27 13:25:44 EDT 2023
On 10/27/23 09:33, David "Judah's Shadow" Blue wrote:
> On Friday, October 27, 2023 8:46:19 AM EDT Troy A. Griffitts wrote:
>> Hi David. There shouldn't be any nulls in the SWMgr::Modules map. Have you
>> done anything with the map which might have created an entry? For example,
>> have you attempted to obtain a module by name which wasn't there? In C++
>> this would create an empty entry with a null pointer if the KJV wasn't
>> installed.
>>
>> SWModule *kjv = swordLibrary->Modules["KJV"];
>>
>> Just trying to guess what might have happened.
> No, I'm declaring the SWModule *tempMod and then the very next thing is
> assigning it to libraryIterator->second.
I don't believe the issue is between when you declare the tempMod
variable and when you assign it.
I believe the issue is between when you construct SWMgr() and when you
get to your code block. Somebody has done something strange with SWMgr
before you get to your code block.
If you give more context, I can have a look. Another thing you can try
is to simply to create 'swordLibrary' just before your `for` loop block
to be sure nothing has gone wrong someplace else.
But to help you debug, I'd need to see a block of code that doesn't work
which also contains your construction of 'swordLibrary' and everything
between that construction and the `for` loop you've posted.
> libraryIterator is a sword::ModMap::iterator if that makes a difference.
>
> While stepping through in my debugger, after I assign tempMod to
> libraryIterator->second looking at the variables, I am getting values in
> tempMod that indicate something is wrong (I can provide those if that would
> help)
>
> Ultimately, I want to build a list of strings of the form "For [module
> description/long name select [module shortname] for all installed modules of a
> given type. Perhaps there is a better way to do that?
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
More information about the sword-devel
mailing list