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

分享图片地址会崩溃 #18

Open
huazidev opened this issue Feb 28, 2018 · 0 comments
Open

分享图片地址会崩溃 #18

huazidev opened this issue Feb 28, 2018 · 0 comments

Comments

@huazidev
Copy link

如果这个图片地址里内容不是图片的会崩溃,看你们的代码里 BitmapFactory.decodeByteArray(var2, 0, var2.length) 获取到的 bitmap为空,但是后续使用的时候没有做非空判断,从而导致崩溃,希望之后能修复以下,因为当分享图片链接时,我们也不知道这个地址到底是不是一个链接,所以还是希望能修复以下,感谢,
附上那段代码:

                        Bitmap var3 = null;
                        var3 = BitmapFactory.decodeByteArray(var2, 0, var2.length);
                        ByteArrayOutputStream var4 = new ByteArrayOutputStream();
                        var4.write(var2, 0, var2.length);

                        for(byte var5 = 0; var4.toByteArray().length > var1 && var5 < 10; var2 = var4.toByteArray()) {
                            double var6 = Math.sqrt(1.0D * (double)var2.length / (double)var1);
                            int var8 = (int)((double)var3.getWidth() / var6);
                            int var9 = (int)((double)var3.getHeight() / var6);
                            var3 = Bitmap.createScaledBitmap(var3, var8, var9, true);
                            var4.reset();
                            var3.compress(var0.compressFormat, 100, var4);
                        }

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

No branches or pull requests

1 participant