File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -151,8 +151,7 @@ export default function handler(req, res) {
151
151
sill ( `Requesting ${ request_uri } ` ) ;
152
152
const fetch_debug_response = fetch ( request_uri ) . then ( ( response ) => {
153
153
return response . json ( ) ;
154
- } ) ;
155
- fetch_debug_response . then ( ( debug_response ) => {
154
+ } ) . then ( ( debug_response ) => {
156
155
// sill(debug_response);
157
156
let ps = { } ;
158
157
let ws = { } ;
@@ -163,7 +162,8 @@ export default function handler(req, res) {
163
162
ws [ it . id ] = it . nodes ;
164
163
}
165
164
} ) ;
166
- const path_found = shortest_path ( ps , ws , pts [ 0 ] , pts [ pts . length - 1 ] ) ;
165
+ sill ( pts . length ) ;
166
+ const path_found = pts . length < 2 ? [ ] : shortest_path ( ps , ws , pts [ 0 ] , pts [ pts . length - 1 ] ) ;
167
167
res . status ( 200 ) . json ( {
168
168
log : `Method: click\nArgs: ${ pts } \nStatus: requested "${ request_uri } ", got response ${ JSON . stringify ( debug_response . elements ) } ` ,
169
169
multipolyline : JSON . stringify ( path_found ) ,
You can’t perform that action at this time.
0 commit comments