changeset 1181:1335e088e7ef

fixed bug it was possible to submit the coordinates input field when it's empty, causing the fairway profile to crash
author Markus Kottlaender <markus@intevation.de>
date Thu, 15 Nov 2018 13:47:04 +0100
parents 03c820e25573
children 936dd3714325
files client/src/fairway/Fairwayprofile.vue
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/fairway/Fairwayprofile.vue	Thu Nov 15 12:16:00 2018 +0100
+++ b/client/src/fairway/Fairwayprofile.vue	Thu Nov 15 13:47:04 2018 +0100
@@ -75,7 +75,10 @@
                         Enter coordinates manually:
                         <div class="position-relative">
                             <input class="form-control form-control-sm pr-5" placeholder="Lat,Lon,Lat,Lon" v-model="coordinatesInput" /><br>
-                            <button class="btn btn-sm btn-outline-secondary position-absolute" @click="applyManualCoordinates" style="top: 0; right: 0;">
+                            <button class="btn btn-sm btn-outline-secondary position-absolute" 
+                                    @click="applyManualCoordinates"
+                                    style="top: 0; right: 0;"
+                                    v-if="coordinatesInput">
                               <i class="fa fa-check"></i>
                             </button>
                         </div>
@@ -518,12 +521,14 @@
       const coordinates = this.coordinatesInput
         .split(",")
         .map(coord => parseFloat(coord.trim()));
-      this.applyCoordinates([
-        coordinates[1],
-        coordinates[0],
-        coordinates[3],
-        coordinates[2]
-      ]);
+      if (coordinates.length === 4) {
+        this.applyCoordinates([
+          coordinates[1],
+          coordinates[0],
+          coordinates[3],
+          coordinates[2]
+        ]);
+      }
     },
     applyCoordinates(coordinates) {
       if (coordinates.length === 4) {