Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d97df402
Commit
d97df402
authored
May 24, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ImageCache should handle images that fail to decode (#4118)
parent
f012a0fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
image_cache.dart
packages/flutter/lib/src/services/image_cache.dart
+10
-5
No files found.
packages/flutter/lib/src/services/image_cache.dart
View file @
d97df402
...
@@ -4,10 +4,11 @@
...
@@ -4,10 +4,11 @@
import
'dart:async'
;
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:collection'
;
import
'dart:ui'
show
hashValues
;
import
'dart:ui'
show
hashValues
,
Image
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/http.dart'
as
http
;
import
'package:flutter/http.dart'
as
http
;
import
'package:mojo/core.dart'
as
mojo
;
import
'image_decoder.dart'
;
import
'image_decoder.dart'
;
import
'image_resource.dart'
;
import
'image_resource.dart'
;
...
@@ -53,10 +54,14 @@ class _UrlFetcher implements ImageProvider {
...
@@ -53,10 +54,14 @@ class _UrlFetcher implements ImageProvider {
@override
@override
Future
<
ImageInfo
>
loadImage
()
async
{
Future
<
ImageInfo
>
loadImage
()
async
{
try
{
try
{
return
new
ImageInfo
(
final
Uri
resolvedUrl
=
Uri
.
base
.
resolve
(
_url
);
image:
await
decodeImageFromDataPipe
(
await
http
.
readDataPipe
(
Uri
.
base
.
resolve
(
_url
))),
final
mojo
.
MojoDataPipeConsumer
dataPipe
=
await
http
.
readDataPipe
(
resolvedUrl
);
scale:
_scale
if
(
dataPipe
==
null
)
);
throw
'Unable to read data from:
$resolvedUrl
'
;
final
Image
image
=
await
decodeImageFromDataPipe
(
dataPipe
);
if
(
image
==
null
)
throw
'Unable to decode image data from:
$resolvedUrl
'
;
return
new
ImageInfo
(
image:
image
,
scale:
_scale
);
}
catch
(
exception
,
stack
)
{
}
catch
(
exception
,
stack
)
{
FlutterError
.
reportError
(
new
FlutterErrorDetails
(
FlutterError
.
reportError
(
new
FlutterErrorDetails
(
exception:
exception
,
exception:
exception
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment