[Debian-astro-commits] [gyoto] 133/221: Object and Factory: don't create SmartPointer sections if NULL

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

thibaut pushed a commit to branch master
in repository gyoto.

commit 20149de74409aa429cf07f4ba9090224ad796f43
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Mon Dec 8 10:13:39 2014 +0100

    Object and Factory: don't create SmartPointer sections if NULL
---
 lib/Factory.C | 5 +++--
 lib/Object.C  | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/Factory.C b/lib/Factory.C
index 9ee1e97..f3d3117 100644
--- a/lib/Factory.C
+++ b/lib/Factory.C
@@ -596,7 +596,7 @@ Factory::Factory(SmartPointer<Spectrometer::Generic> sp)
 }
 
 void Factory::metric(SmartPointer<Metric::Generic> gg, DOMElement *el) {
-
+  if (!gg && !gg_) return;
   if (gg_ && gg && gg!= gg_) throwError("Inconsistent use of Metrics");
   if (gg && !gg_el_) {
   
@@ -613,6 +613,7 @@ void Factory::metric(SmartPointer<Metric::Generic> gg, DOMElement *el) {
 
 void Factory::astrobj(SmartPointer<Astrobj::Generic> ao, DOMElement *el) {
   GYOTO_DEBUG << endl;
+  if (!ao && !obj_) return;
   if (obj_ && ao && ao!= obj_) throwError("Inconsistent use of Astrobjs");
   if (ao && !obj_el_) {
     GYOTO_DEBUG <<"obj_ = ao;" << endl;
@@ -632,7 +633,7 @@ void Factory::astrobj(SmartPointer<Astrobj::Generic> ao, DOMElement *el) {
 }
 
 void Factory::screen(SmartPointer<Screen> scr, DOMElement *el) {
-
+  if (!scr && !screen_) return;
   if (screen_ && scr && scr!= screen_)
     throwError("Inconsistent use of Screens");
   
diff --git a/lib/Object.C b/lib/Object.C
index a2e2431..661fd34 100644
--- a/lib/Object.C
+++ b/lib/Object.C
@@ -224,11 +224,13 @@ void Object::fillProperty(Gyoto::FactoryMessenger *fmp, Property const &p) const
     fmp->screen(get(p));
     break;
   case Property::spectrum_t:
+    if (!get(p).Spectrum) return;
     childfmp = fmp -> makeChild ( name );
     get(p).Spectrum -> fillElement(childfmp);
     delete childfmp;
     break;
   case Property::spectrometer_t:
+    if (!get(p).Spectrometer) return;
     childfmp = fmp -> makeChild ( name );
     get(p).Spectrometer -> fillElement(childfmp);
     delete childfmp;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git



More information about the Debian-astro-commits mailing list