[sword-svn] r3339 - trunk/src/modules/filters

refdoc at crosswire.org refdoc at crosswire.org
Thu Mar 12 13:50:13 MST 2015


Author: refdoc
Date: 2015-03-12 13:50:13 -0700 (Thu, 12 Mar 2015)
New Revision: 3339

Modified:
   trunk/src/modules/filters/osislatex.cpp
Log:
added several checks for (u->module) prior to using it


Modified: trunk/src/modules/filters/osislatex.cpp
===================================================================
--- trunk/src/modules/filters/osislatex.cpp	2015-03-12 20:04:06 UTC (rev 3338)
+++ trunk/src/modules/filters/osislatex.cpp	2015-03-12 20:50:13 UTC (rev 3339)
@@ -250,7 +250,10 @@
 
 					if (!strongsMarkup) {	// leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off
 						SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
-						SWBuf footnoteBody = u->module->getEntryAttributes()["Footnote"][footnoteNumber]["body"];
+						SWBuf footnoteBody = "";
+						if (u->module){
+							footnoteBody += u->module->getEntryAttributes()["Footnote"][footnoteNumber]["body"];
+						}
 						SWBuf noteName = tag.getAttribute("n");
 						VerseKey *vkey = NULL;
 						// char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
@@ -265,21 +268,25 @@
 						SWCATCH ( ... ) {	}
 						if (vkey) {
 							//printf("URL = %s\n",URL::encode(vkey->getText()).c_str());
-							buf.appendFormatted("\\swordfootnote{%s}{%s}{%s}{%s}{%s",
+							buf.appendFormatted("\\swordfootnote{%s}{%s}{%s}{%s}{",
 								 
 								footnoteNumber.c_str(), 
 								u->version.c_str(), 
 								vkey->getText(), 
-								(renderNoteNumbers ? noteName.c_str() : ""),
-								u->module->renderText(footnoteBody).c_str());
+								(renderNoteNumbers ? noteName.c_str() : ""));
+								if (u->module) {
+									buf += u->module->renderText(footnoteBody).c_str();
+								}
 						}
 						else {
-							buf.appendFormatted("\\swordfootnote{%s}{%s}{%s}{%s}{%s",
+							buf.appendFormatted("\\swordfootnote{%s}{%s}{%s}{%s}{",
 								footnoteNumber.c_str(), 
 								u->version.c_str(), 
 								u->key->getText(),  
-								(renderNoteNumbers ? noteName.c_str() : ""),
-								u->module->renderText(footnoteBody).c_str());
+								(renderNoteNumbers ? noteName.c_str() : ""));
+								if (u->module) {
+									buf += u->module->renderText(footnoteBody).c_str();
+								}
 						}
 					}
 				}




More information about the sword-cvs mailing list