[pve-devel] [PATCH common] PVE::CLIHandler::data_to_text: return '' for undef

Stoiko Ivanov s.ivanov at proxmox.com
Tue Jun 26 11:33:46 CEST 2018


Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
Took a quick look at the patch - LGTM.
ran into a tiny problem, if we want to print a property, which is not defined
for an entry (e.g. comment for a user).
src/PVE/CLIHandler.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
index 9933df7..dfdc41c 100644
--- a/src/PVE/CLIHandler.pm
+++ b/src/PVE/CLIHandler.pm
@@ -432,7 +432,7 @@ my $print_bash_completion = sub {
 sub data_to_text {
     my ($data) = @_;
 
-    return undef if !defined($data);
+    return '' if !defined($data);
 
     if (my $class = ref($data)) {
 	return to_json($data, { utf8 => 1, canonical => 1 });
-- 
2.11.0





More information about the pve-devel mailing list