diff --git a/app/Views/bag/_dashboard_kakao_map.php b/app/Views/bag/_dashboard_kakao_map.php index 4e29601..cff8360 100644 --- a/app/Views/bag/_dashboard_kakao_map.php +++ b/app/Views/bag/_dashboard_kakao_map.php @@ -115,19 +115,21 @@ $mapId = 'mainKakaoMap'; (function next(i) { if (i >= tries.length) { cb(null); return; } var mode = tries[i][0], q = tries[i][1]; - if (mode === 'addr') { - geocoder.addressSearch(q, function (result, status) { - if (status === kakao.maps.services.Status.OK && result && result[0]) { - cb(new kakao.maps.LatLng(result[0].y, result[0].x)); - } else { next(i + 1); } - }); - } else { - places.keywordSearch(q, function (data, status) { - if (status === kakao.maps.services.Status.OK && data && data[0]) { - cb(new kakao.maps.LatLng(data[0].y, data[0].x)); - } else { next(i + 1); } - }); - } + try { + if (mode === 'addr') { + geocoder.addressSearch(q, function (result, status) { + if (status === kakao.maps.services.Status.OK && result && result[0]) { + cb(new kakao.maps.LatLng(result[0].y, result[0].x)); + } else { next(i + 1); } + }); + } else { + places.keywordSearch(q, function (data, status) { + if (status === kakao.maps.services.Status.OK && data && data[0]) { + cb(new kakao.maps.LatLng(data[0].y, data[0].x)); + } else { next(i + 1); } + }); + } + } catch (e) { cb(null); } })(0); } @@ -165,15 +167,17 @@ $mapId = 'mainKakaoMap'; SHOPS.forEach(function (shop, idx) { geocodeChain(shop, function (pos) { pending--; - if (pos) { - var marker = new kakao.maps.Marker({ position: pos, map: map }); - markers[idx] = marker; - positions[idx] = pos; - bounds.extend(pos); placed++; - kakao.maps.event.addListener(marker, 'click', function () { openInfo(idx); }); - var dot = document.querySelector('.shop-item[data-idx="' + idx + '"] .shop-dot'); - if (dot) { dot.style.background = '#243a5e'; } - } + try { + if (pos) { + var marker = new kakao.maps.Marker({ position: pos, map: map }); + markers[idx] = marker; + positions[idx] = pos; + bounds.extend(pos); placed++; + kakao.maps.event.addListener(marker, 'click', function () { openInfo(idx); }); + var dot = document.querySelector('.shop-item[data-idx="' + idx + '"] .shop-dot'); + if (dot) { dot.style.background = '#243a5e'; } + } + } catch (e) {} if (pending === 0) done(); }); });