From cf3f16078363b48836b482d883625ea6f3d232b8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 15 Jul 2015 16:02:02 -0400 Subject: [PATCH] add error handling on failure to open serial port --- scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm index a3709b5bb..ddfc53436 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Trigger/Channel/Serial.pm @@ -58,6 +58,12 @@ sub open { my $self = shift; my $device = new Device::SerialPort( $self->{path} ); + if ( ! $device ) + { + Error( "Unable to open $$self{path}: $!" ); + $self->{state} = 'closed'; + return; + } $device->baudrate(9600); $device->databits(8); $device->parity('none');