@@ -377,12 +377,16 @@ -(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker*)marker
377377
378378 if (styles && [styles objectForKey: @" width" ]) {
379379 NSString *widthString = [styles valueForKey: @" width" ];
380+
381+ // check if string is numeric
382+ NSNumberFormatter *nf = [[NSNumberFormatter alloc ] init ];
383+ BOOL isNumeric = [nf numberFromString: widthString] != nil ;
380384
381385 if ([widthString hasSuffix: @" %" ]) {
382386 double widthDouble = [[widthString stringByReplacingOccurrencesOfString: @" %" withString: @" " ] doubleValue ];
383387
384388 width = (int )((double )mapView.frame .size .width * (widthDouble / 100 ));
385- } else if ([widthString isNumeric: widthString] ) {
389+ } else if (isNumeric) {
386390 double widthDouble = [widthString doubleValue ];
387391
388392 if (widthDouble <= 1.0 ) {
@@ -398,14 +402,17 @@ -(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker*)marker
398402 if (styles && [styles objectForKey: @" maxWidth" ]) {
399403 NSString *widthString = [styles valueForKey: @" maxWidth" ];
400404
405+ NSNumberFormatter *nf = [[NSNumberFormatter alloc ] init ];
406+ BOOL isNumeric = [nf numberFromString: widthString] != nil ;
407+
401408 if ([widthString hasSuffix: @" %" ]) {
402409 double widthDouble = [[widthString stringByReplacingOccurrencesOfString: @" %" withString: @" " ] doubleValue ];
403410
404411 maxWidth = (int )((double )mapView.frame .size .width * (widthDouble / 100 ));
405412
406413 // make sure to take padding into account.
407414 maxWidth -= sizeEdgeWidth;
408- } else if ([widthString isNumeric: widthString] ) {
415+ } else if (isNumeric) {
409416 double widthDouble = [widthString doubleValue ];
410417
411418 if (widthDouble <= 1.0 ) {
0 commit comments