From df9641c5487989255cc6b9acc3dd6da087548204 Mon Sep 17 00:00:00 2001 From: Rob Gill Date: Mon, 28 Jan 2019 13:11:50 +1000 Subject: [PATCH] kits/Geolocation Fix PVS404 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Prevent use of uninitialized 'lon' by checking for successful result prior call Change-Id: Ifbd649a8c0c0c37f285cda11e307013929cefa12 Reviewed-on: https://review.haiku-os.org/c/958 Reviewed-by: Jérôme Duval --- src/kits/shared/Geolocation.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kits/shared/Geolocation.cpp b/src/kits/shared/Geolocation.cpp index db712fb9d4..3086abbb41 100644 --- a/src/kits/shared/Geolocation.cpp +++ b/src/kits/shared/Geolocation.cpp @@ -131,8 +131,11 @@ BGeolocation::LocateSelf(float& latitude, float& longitude) double lat, lon; result = location.FindDouble("lat", &lat); - if (result == B_OK) - result = location.FindDouble("lng", &lon); + if (result != B_OK) + return result; + result = location.FindDouble("lng", &lon); + if (result != B_OK) + return result; latitude = lat; longitude = lon;