[gtkmm-documentation] Don't crash when showing GtkCssProvider errors.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Don't crash when showing GtkCssProvider errors.
- Date: Mon, 16 May 2016 18:12:45 +0000 (UTC)
commit cd14745f0a40c96aa2582a44eee742caa1719b22
Author: Murray Cumming <murrayc murrayc com>
Date: Mon May 16 19:54:35 2016 +0200
Don't crash when showing GtkCssProvider errors.
examples/book/custom/custom_widget/mywidget.cc | 7 ++++++-
examples/others/calendar/calendar.cc | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/examples/book/custom/custom_widget/mywidget.cc b/examples/book/custom/custom_widget/mywidget.cc
index 39ceac4..b64021f 100644
--- a/examples/book/custom/custom_widget/mywidget.cc
+++ b/examples/book/custom/custom_widget/mywidget.cc
@@ -238,7 +238,12 @@ void MyWidget::on_parsing_error(const Glib::RefPtr<const Gtk::CssSection>& secti
std::cerr << "on_parsing_error(): " << error.what() << std::endl;
if (section)
{
- std::cerr << " URI = " << section->get_file()->get_uri() << std::endl;
+ const auto file = section->get_file();
+ if (file)
+ {
+ std::cerr << " URI = " << file->get_uri() << std::endl;
+ }
+
std::cerr << " start_line = " << section->get_start_line()+1
<< ", end_line = " << section->get_end_line()+1 << std::endl;
std::cerr << " start_position = " << section->get_start_position()
diff --git a/examples/others/calendar/calendar.cc b/examples/others/calendar/calendar.cc
index b93425b..4e95114 100644
--- a/examples/others/calendar/calendar.cc
+++ b/examples/others/calendar/calendar.cc
@@ -148,7 +148,12 @@ void CalendarExample::on_parsing_error(const Glib::RefPtr<const Gtk::CssSection>
std::cerr << "on_parsing_error(): " << error.what() << std::endl;
if (section)
{
- std::cerr << " URI = " << section->get_file()->get_uri() << std::endl;
+ const auto file = section->get_file();
+ if (file)
+ {
+ std::cerr << " URI = " << file->get_uri() << std::endl;
+ }
+
std::cerr << " start_line = " << section->get_start_line()+1
<< ", end_line = " << section->get_end_line()+1 << std::endl;
std::cerr << " start_position = " << section->get_start_position()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]