Fix crash on creating new file if project is not open.

This resolves issue #4.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/11/head
Slávek Banko 5 years ago
parent c5e1fe9eb3
commit 6fa6e46d9d
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -52,13 +52,17 @@ TQString FileTemplate::read(KDevPlugin *part, const TQString &name, Policy p)
TQString FileTemplate::readFile(KDevPlugin *part, const TQString &fileName)
{
TQDomDocument &dom = *part->projectDom();
TQDomDocument dom;
TQFile f(fileName);
if (!f.open(IO_ReadOnly))
return TQString();
TQTextStream stream(&f);
TQString str = stream.read();
if (part->projectDom())
{
dom = *part->projectDom();
}
return makeSubstitutions( dom, str );
}

Loading…
Cancel
Save