From 0b47aadaf1021d16683bcbdccc403055d82e34ff Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 19 Feb 2006 17:57:31 +0000 Subject: [PATCH] crashless svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=511384 --- libscience/isotope.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libscience/isotope.cpp b/libscience/isotope.cpp index 24b5c62..05faf04 100644 --- a/libscience/isotope.cpp +++ b/libscience/isotope.cpp @@ -29,7 +29,8 @@ Isotope::Isotope() } Isotope::Isotope( ChemicalDataObject* mass, ChemicalDataObject* ID ) - : m_mass( 0 ), m_identifier( 0 ) + : m_parentElementSymbol( 0 ), m_mass( 0 ), m_identifier( 0 ), + m_spin( 0 ), m_magmoment( 0 ), m_halflife( 0 ) { addData( mass ); addData( ID ); @@ -61,35 +62,35 @@ void Isotope::addData( ChemicalDataObject* o ) double Isotope::mass() const { - return m_mass->value().toDouble(); + return m_mass ? m_mass->value().toDouble() : -1.0; } QString Isotope::errorMargin() const { - return m_mass->errorValue().toString(); + return m_mass ? m_mass->errorValue().toString() : QString(); } int Isotope::parentElementNumber() const { - return m_identifier->value().toInt(); + return m_identifier ? m_identifier->value().toInt() : -1; } QString Isotope::spin() const { - return m_spin->value().toString(); + return m_spin ? m_spin->value().toString() : QString(); } QString Isotope::magmoment() const { - return m_magmoment->value().toString(); + return m_magmoment ? m_magmoment->value().toString() : QString(); } double Isotope::halflife() const { - return m_halflife->value().toDouble(); + return m_halflife ? m_halflife->value().toDouble() : -1.0; } QString Isotope::parentElementSymbol() const { - return m_parentElementSymbol->value().toString(); + return m_parentElementSymbol ? m_parentElementSymbol->value().toString() : QString(); } -- 2.47.3