InDesign crashed when trying to create the TOC programmatically
Hi all, I need some help.
We have developed a plugin for InDesign and it tries to create a TOC using a TOC style which is already there in the document.
InterfacePtr<ICommand> myCreateTOCCmd(CmdUtils::CreateCommand(kCreateTOCCmdBoss));
if (myCreateTOCCmd == nil) {
break;
}
InterfacePtr<IStringListData> myStringList(myCreateTOCCmd, UseDefaultIID());
if (myStringList == nil) {
break;
};
InterfacePtr<ITOCCmdData> myCmdData(myCreateTOCCmd, IID_ITOCCMDDATA);
if (myCmdData == nil) {
break;
};
//set myStringList and prepare myCmdData
myErr = CmdUtils::ProcessCommand(myCreateTOCCmd);
When I try to process command, instead of returning an error, indesign crashes. The exception thrown is
"Exception thrown at 0x00007FFB9256D26C (Text.rpln) in InDesign.exe: 0xC0000005: Access violation reading location 0x0000000000000000."
I tried using InDesign Debug version and right before the crash it gave me this message.
"About to use nil interface ptr! Queried IID was IID_IMARGINS, on Boss kSplineItemBoss."
How can I identify the cause of the crash?
