Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6402 for code/branches


Ignore:
Timestamp:
Dec 22, 2009, 10:49:25 PM (15 years ago)
Author:
rgrieder
Message:

Protected ClassTreeMask functions against NULL identifiers.

That can happen for instance in the following situation:
this→targetMask_.exclude(ClassByString("MyClass"));
If MyClass doesn't exist you shouldn't get a segfault anymore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/core/ClassTreeMask.cc

    r6400 r6402  
    291291    void ClassTreeMask::add(const Identifier* subclass, bool bInclude, bool overwrite, bool clean)
    292292    {
     293        if (!subclass)
     294            return;
    293295        // Check if the given subclass is a child of our root-class
    294296        if (subclass->isA(this->root_->getClass()))
     
    320322    void ClassTreeMask::add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude, bool overwrite)
    321323    {
     324        if (!subclass)
     325            return;
    322326        // Check if the current node contains exactly the subclass we want to add
    323327        if (subclass == node->getClass())
     
    395399    void ClassTreeMask::addSingle(const Identifier* subclass, bool bInclude, bool clean)
    396400    {
     401        if (!subclass)
     402            return;
    397403        for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
    398404            this->add(*it, this->isIncluded(*it), false, false);
     
    428434    bool ClassTreeMask::isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const
    429435    {
     436        if (!subclass)
     437            return false;
    430438        // Check if the searched subclass is of the same type as the class in the current node or a derivative
    431439        if (subclass->isA(node->getClass()))
Note: See TracChangeset for help on using the changeset viewer.