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>
(cherry picked from commit 6fa6e46d9d)
r14.0.x
Slávek Banko 5 years ago
parent 7ccaa6d59b
commit 45c6d65135
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) TQString FileTemplate::readFile(KDevPlugin *part, const TQString &fileName)
{ {
TQDomDocument &dom = *part->projectDom(); TQDomDocument dom;
TQFile f(fileName); TQFile f(fileName);
if (!f.open(IO_ReadOnly)) if (!f.open(IO_ReadOnly))
return TQString(); return TQString();
TQTextStream stream(&f); TQTextStream stream(&f);
TQString str = stream.read(); TQString str = stream.read();
if (part->projectDom())
{
dom = *part->projectDom();
}
return makeSubstitutions( dom, str ); return makeSubstitutions( dom, str );
} }

Loading…
Cancel
Save