Opened 8 years ago

Last modified 8 years ago

#14640 confirmed Bug

user agent Uncaught TypeError: Cannot read property '1' of null

Reported by: André B. Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description

Hi There,

I got a bad issue with some user agent that got the "applewebkit/" word without the version number on it (for example : "mozilla/5.0 (linux; u; android 5.1.1; fr-fr; sm-g925f build/lmy47x) applewebkit/"), I got some other user agent in this case, but this one is a good example I suppose.

The code is trying to get a version number with a regexp, and try to get the first item.

// line 297 for version 4.5.9 revision a35abfe
b.webkit && (c = parseFloat(a.match(/ applewebkit\/(\d+)/)[1]));

Expected result

No javascript error

Actual result

Uncaught TypeError: Cannot read property '1' of null

Other details (browser, OS, CKEditor version, installed plugins)

You can try this issue on the demo page : http://ckeditor.com/demo Just add the given user agent to the console emulator and you should get the same issue. (mozilla/5.0 (linux; u; android 5.1.1; fr-fr; sm-g925f build/lmy47x) applewebkit/)

I am actually using the 4.4.7 version, but the issue is the same with the latest version.

Best, André.

Change History (2)

comment:1 Changed 8 years ago by Jakub Ś

Status: newconfirmed
Version: 4.4.74.0

Problem can be reproduced at least from CKEditor 4.0.

Error:
Message: Uncaught TypeError: Cannot read property '1' of null
Path: /ckeditor-dev/core/env.js
Line: 257

Here are some links showing how to change user agent:
https://www.youtube.com/watch?v=ZhptV6Kd5qE
http://www.howtogeek.com/113439/how-to-change-your-browsers-user-agent-without-installing-any-extensions/


NOTE1:While we probably don't support that browser, error should not be thrown. Just out of curioasity @dredtrake - could you tell us which browser was that? I just want to make sure it exists :)

NOTE2: Probably a simple ternary operator like this one below will do the trick.

var a = ' applewebkit/', b = '';
c = parseFloat( (b = a.match(/ applewebkit\/(\d+)/)) ? b[1] : 0);
Last edited 8 years ago by Jakub Ś (previous) (diff)

comment:2 Changed 8 years ago by André B.

Hi, thanks for your answer, I don't really know the name of the browser used to reproduce this error, the fact is that I got an error reporting tools that gives me the user agent string of the browser and the error, when I add the given user agent to my debugger I got the error... Many user agents are catch with this error. I'll try this now then, Thanks, Best, André

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy