* InsetExternal.cpp:

* GuiExternal.cpp:
	- do not crash if the list of external templates is empty (bug #3974).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31570 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-10-09 12:42:32 +00:00
parent 41924f48f7
commit 7dc9eab62b
4 changed files with 8 additions and 1 deletions

View File

@ -80,6 +80,8 @@ char const * const origin_gui_strs[] = {
external::Template getTemplate(int i)
{
if (external::TemplateManager::get().getTemplates().empty())
return Template();
external::TemplateManager::Templates::const_iterator i1
= external::TemplateManager::get().getTemplates().begin();
advance(i1, i);

View File

@ -104,7 +104,8 @@ InsetExternalParams::InsetExternalParams()
if (defaultTemplateName.empty()) {
external::TemplateManager const & etm =
external::TemplateManager::get();
templatename_ = etm.getTemplates().begin()->first;
if (!etm.getTemplates().empty())
templatename_ = etm.getTemplates().begin()->first;
} else
templatename_ = defaultTemplateName;
}

View File

@ -20,7 +20,9 @@ void doAssert(char const * expr, char const * file, long line)
{
LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line);
// comment this out if not needed
#ifdef ENABLE_ASSERTIONS
BOOST_ASSERT(false);
#endif
}
} // namespace lyx

View File

@ -89,6 +89,8 @@ What's new
- Fix a tex2lyx crash when importing a LaTeX file using an unknown encoding
(bug 6142).
- Fix a crash when no external templates are defined (bug 3974).
- Add encoding "ansinew" as a synonym of "cp1252" for the benefit of
tex2lyx (bug 6142).