diff --git a/libuavcan/src/node/uc_global_data_type_registry.cpp b/libuavcan/src/node/uc_global_data_type_registry.cpp index 1af1c8ab08..fdf0b94921 100644 --- a/libuavcan/src/node/uc_global_data_type_registry.cpp +++ b/libuavcan/src/node/uc_global_data_type_registry.cpp @@ -95,9 +95,20 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d p = p->getNextListNode(); } } +#if UAVCAN_DEBUG + const unsigned len_before = list->getLength(); +#endif list->insertBefore(dtd, EntryInsertionComparator(dtd)); #if UAVCAN_DEBUG + { // List integrity check + const unsigned len_after = list->getLength(); + if (len_before >= len_after) + { + assert(0); + std::abort(); + } + } { // Order check Entry* p = list->get(); int id = -1;