Fixed segfault in reg_read when no datatype is specified.
--- a/tool/DataTypeHandler.cpp Thu Apr 15 12:31:12 2010 +0200
+++ b/tool/DataTypeHandler.cpp Thu Apr 15 12:33:48 2010 +0200
@@ -269,12 +269,19 @@
size_t dataSize
)
{
- if (type->byteSize && dataSize != type->byteSize) {
- stringstream err;
- err << "Data type mismatch. Expected " << type->name
- << " with " << type->byteSize << " byte, but got "
- << dataSize << " byte.";
- throw SizeException(err.str());
+ uint16_t typeCode;
+
+ if (type) {
+ if (type->byteSize && dataSize != type->byteSize) {
+ stringstream err;
+ err << "Data type mismatch. Expected " << type->name
+ << " with " << type->byteSize << " byte, but got "
+ << dataSize << " byte.";
+ throw SizeException(err.str());
+ }
+ typeCode = type->code;
+ } else {
+ typeCode = 0xffff; // raw data
}
o << setfill('0');