r4139: 2nd attempt at fixing the null ptr in size_is() problem.
[samba.git] / source4 / build / pidl / parser.pm
index 375558e5dc1a44fb5f0421fff11ba497496a78ac..8fb74b2e0ed882e7f650a7bdaa25ec6765f1f185 100644 (file)
@@ -288,14 +288,18 @@ sub CheckArraySizes($$)
 
        if (util::has_property($e, "size_is")) {
                my $size = find_size_var($e, util::array_size($e), $var_prefix);
 
        if (util::has_property($e, "size_is")) {
                my $size = find_size_var($e, util::array_size($e), $var_prefix);
+               pidl "\tif ($var_prefix$e->{NAME}) {\n";
                check_null_pointer($size);
                check_null_pointer($size);
-               pidl "\tNDR_CHECK(ndr_check_array_size(ndr, (void*)&$var_prefix$e->{NAME}, $size));\n";
+               pidl "\t\tNDR_CHECK(ndr_check_array_size(ndr, (void*)&$var_prefix$e->{NAME}, $size));\n";
+               pidl "\t}\n";
        }
 
        if (my $length = util::has_property($e, "length_is")) {
                $length = find_size_var($e, $length, $var_prefix);
        }
 
        if (my $length = util::has_property($e, "length_is")) {
                $length = find_size_var($e, $length, $var_prefix);
+               pidl "\tif ($var_prefix$e->{NAME}) {\n";
                check_null_pointer($length);
                check_null_pointer($length);
-               pidl "\tNDR_CHECK(ndr_check_array_length(ndr, (void*)&$var_prefix$e->{NAME}, $length));\n";
+               pidl "\t\tNDR_CHECK(ndr_check_array_length(ndr, (void*)&$var_prefix$e->{NAME}, $length));\n";
+               pidl "\t}\n";
        }
 }
 
        }
 }