summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgenerator/nanopb_generator.py2
-rw-r--r--tests/extensions/extensions.proto2
2 files changed, 3 insertions, 1 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index c32b26ad..0660d20e 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -351,6 +351,8 @@ class Field:
result += '0)'
elif self.pbtype in ['BYTES', 'STRING'] and self.allocation != 'STATIC':
result += '0)' # Arbitrary size default values not implemented
+ elif self.rules == 'OPTEXT':
+ result += '0)' # Default value for extensions is not implemented
else:
result += '&%s_default)' % (self.struct_name + self.name)
diff --git a/tests/extensions/extensions.proto b/tests/extensions/extensions.proto
index d85e8193..da8432e0 100644
--- a/tests/extensions/extensions.proto
+++ b/tests/extensions/extensions.proto
@@ -1,7 +1,7 @@
import 'alltypes.proto';
extend AllTypes {
- optional int32 AllTypes_extensionfield1 = 255;
+ optional int32 AllTypes_extensionfield1 = 255 [default = 5];
}
message ExtensionMessage {