mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
[wpiutil] Fix dynamic struct decoding for nested structs (#7346)
After a struct-type field descriptor had offsets calculated more than once, IsBitField would return true, causing the second call to CalculateOffsets to calculate incorrect offsets.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -234,7 +235,8 @@ class StructFieldDescriptor {
|
||||
* @return true if bitfield
|
||||
*/
|
||||
bool IsBitField() const {
|
||||
return m_bitShift != 0 || m_bitWidth != (m_size * 8);
|
||||
return (m_bitShift != 0 || m_bitWidth != (m_size * 8)) &&
|
||||
m_struct == nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user