From 685803792e5247b172e5f8e5128f8ddcc3a97fec Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Wed, 4 Dec 2019 14:03:31 +0700 Subject: [PATCH] Fix empty map. --- inc/template-functions.php | 4 ++++ templates/single-property/nearby.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/inc/template-functions.php b/inc/template-functions.php index a43d73e8..58813378 100755 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -741,6 +741,10 @@ function opalestate_get_property_walkscore_results( $property ) { $map = $property->get_map(); + if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { + return false; + } + $latitude = $map['latitude']; $longitude = $map['longitude']; diff --git a/templates/single-property/nearby.php b/templates/single-property/nearby.php index c7872bff..09d52c85 100755 --- a/templates/single-property/nearby.php +++ b/templates/single-property/nearby.php @@ -16,6 +16,10 @@ if ( ! $categories ) { $map = $property->get_map(); +if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { + return; +} + $latitude = $map['latitude']; $longitude = $map['longitude']; if ( ! $latitude || ! $longitude ) {