Skip to content

fix: added a typeof check to prevent crash without internet connection#811

Open
mauriciosfriso wants to merge 1 commit into
tomchentw:masterfrom
mauriciosfriso:master
Open

fix: added a typeof check to prevent crash without internet connection#811
mauriciosfriso wants to merge 1 commit into
tomchentw:masterfrom
mauriciosfriso:master

Conversation

@mauriciosfriso

@mauriciosfriso mauriciosfriso commented Mar 22, 2018

Copy link
Copy Markdown

When there isn´t a internet connection, the app crash.

@Simek

Simek commented Apr 12, 2018

Copy link
Copy Markdown
Contributor

I think we should check also if maps in google is available.
Rewriting check to if(!google || !google.maps) should be enough.

@mauriciosfriso

Copy link
Copy Markdown
Author

I check your code and does't works. I getting: google is not defined.
if you will check remember delete browser cache

@Simek

Simek commented Apr 12, 2018

Copy link
Copy Markdown
Contributor

@mauriciosfriso Sorry for wrong example, my mistake, conditions in my example should be reversed.
if(google && google.maps).

@mauriciosfriso

mauriciosfriso commented Apr 12, 2018

Copy link
Copy Markdown
Author

@Simek I see your mistake, but anyway it's not works. I keep getting:

google is not defined

therefore I check the google's type

sorry for my English

@Simek

Simek commented Apr 13, 2018

Copy link
Copy Markdown
Contributor

I've dig a little bit into this problem. Seems that google is set to be an identifier until script loads. This causes !google check to throw "undefined" error so your code comparing type is correct way to check this. And don't worry about your english. It's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants