summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-01 14:01:02 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-01 14:01:02 -0700
commit9703c9a871cf19cc05a034184b5f7ead971bd080 (patch)
treeea4c50b5de9f9e232918e0967f6cf18f7c2f52c0 /lib
parent44103879a68941af1550178c9869eec7f69fad4b (diff)
downloadvyatta-cfg-qos-9703c9a871cf19cc05a034184b5f7ead971bd080.tar.gz
vyatta-cfg-qos-9703c9a871cf19cc05a034184b5f7ead971bd080.zip
Handle missing rate value more gracefully
Diffstat (limited to 'lib')
-rw-r--r--lib/Vyatta/Qos/Util.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Vyatta/Qos/Util.pm b/lib/Vyatta/Qos/Util.pm
index 151b1d3..242e2b4 100644
--- a/lib/Vyatta/Qos/Util.pm
+++ b/lib/Vyatta/Qos/Util.pm
@@ -27,6 +27,9 @@ use base qw(Exporter);
sub get_num {
use POSIX qw(strtod);
my ($str) = @_;
+ return unless $str;
+
+ # remove leading/trailing spaces
$str =~ s/^\s+//;
$str =~ s/\s+$//;
@@ -86,6 +89,8 @@ sub getAutoRate {
sub getRate {
my $rate = shift;
+ $rate or die "Rate not defined";
+
my ( $num, $suffix ) = get_num($rate);
defined $num