Remove SEGFAULT possibility from gswe_moment_calculate_planet()
This commit is contained in:
		@@ -843,13 +843,20 @@ gswe_moment_add_all_planets(GsweMoment *moment)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
gswe_moment_calculate_planet(
 | 
					gswe_moment_calculate_planet(GsweMoment *moment,
 | 
				
			||||||
        GsweMoment *moment,
 | 
					                             GswePlanet planet,
 | 
				
			||||||
        GswePlanet planet,
 | 
					                             GError     **err)
 | 
				
			||||||
        GError **err)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // TODO: g_list_find_custom may return NULL here. SEGFAULT possibility!
 | 
					    GswePlanetData *planet_data;
 | 
				
			||||||
    GswePlanetData *planet_data = (GswePlanetData *)(g_list_find_custom(
 | 
					    gpointer       data         = g_list_find_custom(
 | 
				
			||||||
 | 
					            moment->priv->planet_list,
 | 
				
			||||||
 | 
					            &planet,
 | 
				
			||||||
 | 
					            (GCompareFunc)find_planet_by_id
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    g_return_if_fail(data != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    planet_data = (GswePlanetData *)(g_list_find_custom(
 | 
				
			||||||
                moment->priv->planet_list,
 | 
					                moment->priv->planet_list,
 | 
				
			||||||
                &planet,
 | 
					                &planet,
 | 
				
			||||||
                (GCompareFunc)find_planet_by_id
 | 
					                (GCompareFunc)find_planet_by_id
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user