diff --git a/sources/conductor.cpp b/sources/conductor.cpp index ead9db9a8..22cb53608 100644 --- a/sources/conductor.cpp +++ b/sources/conductor.cpp @@ -1322,13 +1322,16 @@ QSet Conductor::relatedConductors() const { * le meme potentiel electrique a l'exception de lui même */ QSet Conductor::relatedPotentialConductors(QList *t_list) { - if (t_list == 0) + bool declar_t_list = false; + if (t_list == 0) { + declar_t_list = true; t_list = new QList ; + } QSet other_conductors; //renvoie tous les conducteurs du terminal 1 - if (t_list->contains(terminal1) == false) { - t_list->append(terminal1); + if (!t_list -> contains(terminal1)) { + t_list -> append(terminal1); QList other_conductors_list_t1 = terminal1 -> conductors(); other_conductors_list_t1.removeAll(this); //recherche les conducteurs connecté au conducteur déjà trouvé @@ -1338,8 +1341,8 @@ QSet Conductor::relatedPotentialConductors(QList *t_li other_conductors += other_conductors_list_t1.toSet(); } //renvoie tous les conducteurs du terminal 2 - if (t_list->contains(terminal2) == false) { - t_list->append(terminal2); + if (!t_list -> contains(terminal2)) { + t_list -> append(terminal2); QList other_conductors_list_t2 = terminal2 -> conductors(); other_conductors_list_t2.removeAll(this); //recherche les conducteurs connecté au conducteur déjà trouvé @@ -1349,6 +1352,8 @@ QSet Conductor::relatedPotentialConductors(QList *t_li other_conductors += other_conductors_list_t2.toSet(); } other_conductors.remove(const_cast(this)); + + if (declar_t_list) delete t_list; return(other_conductors); }