Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Casanowow Life for love
VLC-Android
Commits
fd165128
Commit
fd165128
authored
Mar 16, 2018
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BitmapUtil: Prevent NPE on app startup
parent
b74887c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
vlc-android/src/org/videolan/vlc/gui/helpers/BitmapUtil.java
vlc-android/src/org/videolan/vlc/gui/helpers/BitmapUtil.java
+7
-7
No files found.
vlc-android/src/org/videolan/vlc/gui/helpers/BitmapUtil.java
View file @
fd165128
...
...
@@ -100,8 +100,8 @@ public class BitmapUtil {
private
static
Bitmap
fetchPicture
(
MediaWrapper
media
)
{
final
BitmapCache
cache
=
BitmapCache
.
getInstance
();
Bitmap
picture
=
readCoverBitmap
(
media
.
getArtworkURL
());
cache
.
addBitmapToMemCache
(
media
.
getLocation
(),
picture
);
final
Bitmap
picture
=
readCoverBitmap
(
media
.
getArtworkURL
());
if
(
picture
!=
null
)
cache
.
addBitmapToMemCache
(
media
.
getLocation
(),
picture
);
return
picture
;
}
...
...
@@ -114,12 +114,12 @@ public class BitmapUtil {
}
private
static
Bitmap
readCoverBitmap
(
String
path
)
{
if
(
path
==
null
)
return
null
;
Resources
res
=
VLCApplication
.
getAppResources
();
if
(
path
==
null
)
return
null
;
final
Context
ctx
=
VLCApplication
.
getAppContext
();
if
(
ctx
==
null
)
return
null
;
final
Resources
res
=
ctx
.
getResources
();
String
uri
=
Uri
.
decode
(
path
);
if
(
uri
.
startsWith
(
"file://"
))
uri
=
uri
.
substring
(
7
);
if
(
uri
.
startsWith
(
"file://"
))
uri
=
uri
.
substring
(
7
);
Bitmap
cover
=
null
;
BitmapFactory
.
Options
options
=
new
BitmapFactory
.
Options
();
int
height
=
res
.
getDimensionPixelSize
(
R
.
dimen
.
grid_card_thumb_height
);
...
...
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