diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-01-23 16:24:14 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2023-01-23 16:24:14 +0100 |
| commit | bd5a42eba8d0f6da3e98d9d8a294556577180c7c (patch) | |
| tree | 020797c475b4b7984c7264495b7f7b3371f4dfea /fluid | |
| parent | 3a7c9fe9781067075c38393b6599d8095a777483 (diff) | |
FLUID: unneeded assignment, possible NULL pointer (#660)
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Type.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index 5bf28e016..2db91d5d3 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -299,14 +299,16 @@ Fl_Type::~Fl_Type() { Fl_Type *Fl_Type::prev_sibling() { Fl_Type *n; for (n = prev; n && n->level > level; n = n->prev) ; - return n; + if (n && (n->level == level)) + return n; + return 0; } // Return the next sibling in the tree structure or NULL. Fl_Type *Fl_Type::next_sibling() { Fl_Type *n; for (n = next; n && n->level > level; n = n->next) ; - if (n->level==level) + if (n && (n->level == level)) return n; return 0; } @@ -410,9 +412,9 @@ void Fl_Type::add(Fl_Type *p, Strategy strategy) { // we have current, t is the new node, p is the parent // find the next child of the parent after current //t->add(p); // add as a last child - Fl_Type *cc = current; - for (cc = current->next; cc; cc=cc->next) { - if (cc->level<=this->level) + Fl_Type *cc; + for (cc = current->next; cc; cc = cc->next) { + if (cc->level <= this->level) break; } if (cc && cc->level==this->level && cc!=this) { |
