diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2019-12-16 20:56:37 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-12-17 17:02:33 +0100 |
commit | 45c6d651358e9a288326a06a0b51c37bca9b1392 (patch) | |
tree | 81a2a544bad9bb26c5d29be219eb27740812f07a /lib | |
parent | 7ccaa6d59b38585e90e242014677fd8bcb57c3af (diff) | |
download | tdevelop-45c6d651358e9a288326a06a0b51c37bca9b1392.tar.gz tdevelop-45c6d651358e9a288326a06a0b51c37bca9b1392.zip |
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 6fa6e46d9d7becae27a8e1534ec5da8833ff7c17)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/filetemplate.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/util/filetemplate.cpp b/lib/util/filetemplate.cpp index c2454580..bb2cb7c6 100644 --- a/lib/util/filetemplate.cpp +++ b/lib/util/filetemplate.cpp @@ -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 ); } |