From 06fce9c9d50cbeeb766ba07499505bb50df512c9 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 2 Sep 2014 11:56:10 +0200 Subject: [PATCH] Add error reporting to add_points() It is possible that planet_data->sign_info is NULL, which results in a SEGFAULT. --- src/gswe-moment.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gswe-moment.c b/src/gswe-moment.c index 17f22f4..cfaa321 100644 --- a/src/gswe-moment.c +++ b/src/gswe-moment.c @@ -1156,7 +1156,17 @@ add_points(GswePlanetData *planet_data, GsweMoment *moment) ); sign_info = gswe_planet_data_get_sign_info(planet_data); + + if (G_UNLIKELY(sign_info == NULL)) { + g_error("Planet data calculation failed"); + } + planet_info = gswe_planet_data_get_planet_info(planet_data); + + if (G_UNLIKELY(planet_info == NULL)) { + g_error("Planet data calculation failed. No planet info."); + } + element = gswe_sign_info_get_element(sign_info); point = GPOINTER_TO_INT(g_hash_table_lookup( moment->priv->element_points,