summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Martin Gysel <me@bearsh.org>2016-10-13 13:39:58 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-20 21:18:59 -0700
commit0ea0272806e6a651782f17ecb75fd1345e2ca8cb (patch)
tree65abf5bf96c74881ae74ba4d08d39f81cc66a97c /desktop-widgets
parentd6893901405d3609df9ec1a321757e59d5c7b670 (diff)
downloadsubsurface-0ea0272806e6a651782f17ecb75fd1345e2ca8cb.tar.gz
TeX export: check site pointer, before accessing it
Print empty string rather than 'null' Signed-off-by: Martin Gysel <me@bearsh.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogexportdialog.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp
index 9d3d27129..6121bd9eb 100644
--- a/desktop-widgets/divelogexportdialog.cpp
+++ b/desktop-widgets/divelogexportdialog.cpp
@@ -282,7 +282,7 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
put_format(&buf, "\\def\\date{%04u-%02u-%02u}\n",
tm.tm_year, tm.tm_mon+1, tm.tm_mday);
put_format(&buf, "\\def\\number{%d}\n", dive->number);
- put_format(&buf, "\\def\\place{%s}\n", site->name);
+ put_format(&buf, "\\def\\place{%s}\n", site ? site->name : "");
put_format(&buf, "\\def\\spot{}\n");
put_format(&buf, "\\def\\country{}\n");
put_format(&buf, "\\def\\entrance{}\n");
@@ -293,8 +293,8 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
put_format(&buf, "\\def\\type{%s}\n", dive->tag_list ? dive->tag_list->tag->name : "");
put_format(&buf, "\\def\\viz{%s}\n", viz.toUtf8().data());
put_format(&buf, "\\def\\plot{\\includegraphics[width=9cm,height=4cm]{profile%d}}\n", dive->number);
- put_format(&buf, "\\def\\comment{%s}\n", dive->notes);
- put_format(&buf, "\\def\\buddy{%s}\n", dive->buddy);
+ put_format(&buf, "\\def\\comment{%s}\n", dive->notes ? dive->notes : "");
+ put_format(&buf, "\\def\\buddy{%s}\n", dive->buddy ? dive->buddy : "");
put_format(&buf, "\\page\n");
}