Null pointer checks

This commit is contained in:
Pavel Kirienko
2014-04-19 16:47:14 +04:00
parent efb2251ef8
commit acff3d274c
2 changed files with 9 additions and 2 deletions
@@ -37,10 +37,14 @@ class UAVCAN_EXPORT GlobalDataTypeRegistry : Noncopyable
struct EntryInsertionComparator
{
const DataTypeID id;
explicit EntryInsertionComparator(Entry* dtd) : id(dtd->descriptor.getID()) { }
explicit EntryInsertionComparator(const Entry* dtd)
: id((dtd == NULL) ? DataTypeID() : dtd->descriptor.getID())
{
assert(dtd != NULL);
}
bool operator()(const Entry* entry) const
{
assert(entry);
assert(entry != NULL);
return entry->descriptor.getID() > id;
}
};