Check that [UIImage imageWithContentsOfFile:] and [NSData dataWithContentsOfFile:] do not return nil. |
|||||
Issue descriptionIn debug mode, we should make sure that the following methods (and possibly more) never return nil: [UIIMage imageWithContentsOfFile:] [NSData dataWithContentsOfFile:] It should be done by generalizing the function swizzleUIImageImageNamed() in ios/chrome/app/startup/setup_debugging.mm.
,
May 31 2017
Those methods are also used to load file that may not exists (saved session for example) as it is cheaper to try and load data, and handle its absence than checking for existence before loading it.
,
May 31 2017
Assuming you are talking about [NSData dataWithContentsOfFile:], here are possible solutions: 1/ Whitelist the files that may not exists. 2/ Only DCHECK when the extension of the file is png/jpg/... 3/ create a category methods [NSData cr_dataWithContentsOfFileThatMayNotExist] that we use when the file may not exist.
,
May 31 2017
Erratum: 1/ and 2/ wouldn't work in the case of the saved session: There's an infinite number of file paths, and the file paths end with .jpg
,
Sep 14 2017
,
Sep 14 2017
,
Jun 22 2018
jif@ is no longer on the team. Releasing his bugs for triage.
,
Jun 27 2018
Maybe a good first bug? |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by jif@chromium.org
, May 11 2017