Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot handle placehold.it GIFs #134

Closed
TWiStErRob opened this issue Sep 14, 2014 · 2 comments
Closed

Cannot handle placehold.it GIFs #134

TWiStErRob opened this issue Sep 14, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@TWiStErRob
Copy link
Collaborator

The most basic example:

Glide.with(context).load("http://placehold.it/350x150").into(holder.icon);

throws:

09-14 12:51:57.633  11313-11313/net.twisterrob A/GLIDE﹕ Cannot load http://placehold.it/350x150 into Target for: android.widget.ImageView{42b6c8c0 V.ED.... ........ 0,0-24,144 #7f070001 app:id/icon}
    java.lang.NullPointerException
            at com.bumptech.glide.gifdecoder.GifHeaderParser.readBitmap(GifHeaderParser.java:160)
            at com.bumptech.glide.gifdecoder.GifHeaderParser.readContents(GifHeaderParser.java:80)
            at com.bumptech.glide.gifdecoder.GifHeaderParser.parseHeader(GifHeaderParser.java:60)
            at com.bumptech.glide.load.resource.gif.GifResourceDecoder.decode(GifResourceDecoder.java:62)
            at com.bumptech.glide.load.resource.gif.GifResourceDecoder.decode(GifResourceDecoder.java:55)
            at com.bumptech.glide.load.resource.gif.GifResourceDecoder.decode(GifResourceDecoder.java:29)
            at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:73)
            at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:56)
            at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:19)
            at com.bumptech.glide.load.engine.SourceResourceRunner.decodeFromSource(SourceResourceRunner.java:183)
            at com.bumptech.glide.load.engine.SourceResourceRunner.runWrapped(SourceResourceRunner.java:144)
            at com.bumptech.glide.load.engine.SourceResourceRunner.run(SourceResourceRunner.java:123)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
            at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:52)
@TWiStErRob
Copy link
Collaborator Author

Debugged: after reading the header it started the content and header.currentFrame is null, because it went straight to 0x2C (image separator) without any extensions.

.asBitmap() solves the problem.

@sjudd
Copy link
Collaborator

sjudd commented Sep 14, 2014

Thanks for reporting this! Gifs are definitely a bit of an incubating feature (to steal Gradle's terminology), so I expect we will find a fair number of bugs like this.

For debugging this and other bugs I found a couple of particularly helpful websites:
The gif spec: http://www.w3.org/Graphics/GIF/spec-gif89a.txt

A much easier to read overview of the format and common extensions: http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp

I'll continue to look in to it and hopefully have a fix today.

Also I had no idea about placehold.it, that's an awesome website and could be very useful for writing integration tests, glad you brought it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants