Skip to content

Commit 2b7516e

Browse files
eheydrickmajormoses
authored andcommitted
Add a nil check to avoid failure when the query result is empty
1 parent 5f73167 commit 2b7516e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
55

66
## [Unreleased]
7+
### Fixed
8+
- metrics-postgres-query.rb: Add a nil check to avoid failure when the query result is empty (@eheydrick)
79

810
## [1.4.0] - 2017-08-04
911
### Added

bin/metrics-postgres-query.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def run
114114
value = if config[:count_tuples]
115115
res.ntuples
116116
else
117-
res.first.values.first
117+
res.first.values.first unless res.first.nil?
118118
end
119119

120120
if config[:multirow] && !config[:count_tuples]

0 commit comments

Comments
 (0)