From 5d96a8d14ecea48dc212f781532957f742c693cb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 13 Jul 2017 09:38:42 -0400 Subject: [PATCH] make code more robust by handling an undefined get_VideoEncoderConfiguration() --- onvif/scripts/zmonvif-probe.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/onvif/scripts/zmonvif-probe.pl b/onvif/scripts/zmonvif-probe.pl index c66403e56..7d4eaa25b 100755 --- a/onvif/scripts/zmonvif-probe.pl +++ b/onvif/scripts/zmonvif-probe.pl @@ -253,13 +253,16 @@ sub profiles foreach my $profile ( @{ $profiles } ) { my $token = $profile->attr()->get_token() ; - print $token . ", " . - $profile->get_Name() . ", " . - $profile->get_VideoEncoderConfiguration()->get_Encoding() . ", " . - $profile->get_VideoEncoderConfiguration()->get_Resolution()->get_Width() . ", " . - $profile->get_VideoEncoderConfiguration()->get_Resolution()->get_Height() . ", " . - $profile->get_VideoEncoderConfiguration()->get_RateControl()->get_FrameRateLimit() . - ", "; + my $VideoEncoderConfiguration = $profile->get_VideoEncoderConfiguration(); + print join(', ', $token, + $profile->get_Name(), + ( $VideoEncoderConfiguration ? ( + $VideoEncoderConfiguration->get_Encoding(), + $VideoEncoderConfiguration->get_Resolution()->get_Width(), + $VideoEncoderConfiguration->get_Resolution()->get_Height(), + $VideoEncoderConfiguration->get_RateControl()->get_FrameRateLimit(), + ) : () ) + ); # Specification gives conflicting values for unicast stream types, try both. # http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl#op.GetStreamUri