From df255d3d5d174190db36087c1514865773474996 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 4 Oct 2016 14:07:11 -0400 Subject: [PATCH] check for existence of attribute before calling it to break gently --- onvif/modules/lib/ONVIF/Deserializer/MessageParser.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onvif/modules/lib/ONVIF/Deserializer/MessageParser.pm b/onvif/modules/lib/ONVIF/Deserializer/MessageParser.pm index b0ce6f0fd..0e4b6dcfb 100644 --- a/onvif/modules/lib/ONVIF/Deserializer/MessageParser.pm +++ b/onvif/modules/lib/ONVIF/Deserializer/MessageParser.pm @@ -272,7 +272,11 @@ sub _initialize { # $_method =~s{\.}{__}xg; $_method =~s{\-}{_}xg; - $list->[-1]->$_method( $current ); + if ( $list->[-1]->can( $_method ) ) { + $list->[-1]->$_method( $current ); + } else { + print ( "ERror " . $list->[-1] . " cannot $_method\n" ); + } $current = pop @$list; # step up in object hierarchy