summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/struct_definition.hh
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-04-09 16:23:03 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-09 16:26:50 -0300
commite7e1d777f1107940164246a9e3e5921ba37eb8cf (patch)
tree0f94887701a063e56abdb0766e2ea7060d8b2646 /src/bin/eolian_mono/eolian/mono/struct_definition.hh
parentdf3b28b0ab650beb5d0fede24b164d2cc9c40ba9 (diff)
csharp: Add some null checks.
Summary: - Check for nullness when getting stuff from C# to C - We should return null when wrapping a NULL pointer instead of throwing an exception Reviewers: felipealmeida, vitor.sousa, woohyun Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8580
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/struct_definition.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index c059dd9cbe..d8f03118e7 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -48,7 +48,7 @@ struct to_internal_field_convert_generator
48 if (klass) 48 if (klass)
49 { 49 {
50 if (!as_generator( 50 if (!as_generator(
51 indent << scope_tab << scope_tab << "_internal_struct." << string << " = _external_struct." << string << ".NativeHandle;\n") 51 indent << scope_tab << scope_tab << "_internal_struct." << string << " = _external_struct." << string << "?.NativeHandle ?? System.IntPtr.Zero;\n")
52 .generate(sink, std::make_tuple(field_name, field_name), context)) 52 .generate(sink, std::make_tuple(field_name, field_name), context))
53 return false; 53 return false;
54 } 54 }
@@ -112,7 +112,7 @@ struct to_internal_field_convert_generator
112 else if (field.type.c_type == "Eina_Value *" || field.type.c_type == "const Eina_Value *") 112 else if (field.type.c_type == "Eina_Value *" || field.type.c_type == "const Eina_Value *")
113 { 113 {
114 if (!as_generator( 114 if (!as_generator(
115 indent << scope_tab << scope_tab << "_internal_struct." << string << " = _external_struct." << string << ".NativeHandle;\n" 115 indent << scope_tab << scope_tab << "_internal_struct." << string << " = _external_struct." << string << "?.NativeHandle ?? System.IntPtr.Zero;\n"
116 ).generate(sink, std::make_tuple(field_name, field_name), context)) 116 ).generate(sink, std::make_tuple(field_name, field_name), context))
117 return false; 117 return false;
118 } 118 }