]> git.proxmox.com Git - pve-common.git/commitdiff
fix #1914: CLIFormatter: check also for existence of 'type'
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 17 Sep 2018 08:32:03 +0000 (10:32 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 17 Sep 2018 08:58:35 +0000 (10:58 +0200)
we sometimes define

result => {}

on an api call, so check that result->{type} is defined
and guess the type if not

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/CLIFormatter.pm

index 47021800956a806904aec6d885aadb2804bc8fa1..3040323eff0f480fe096fbdf1be2c196e80181b3 100644 (file)
@@ -409,7 +409,7 @@ sub print_api_result {
 
     my $format = $options->{'output-format'} // 'text';
 
 
     my $format = $options->{'output-format'} // 'text';
 
-    if ($result_schema) {
+    if ($result_schema && defined($result_schema->{type})) {
        return if $result_schema->{type} eq 'null';
     } else {
        my $type = $guess_type->($data);
        return if $result_schema->{type} eq 'null';
     } else {
        my $type = $guess_type->($data);