File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
app/src/main/java/com/samsung/microbit/utils Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -226,12 +226,8 @@ public static byte[] readBytesFromFile( File file) {
226226 byte [] bytes = null ;
227227 try {
228228 long size = file .length ();
229- if ( size > Integer .MAX_VALUE ) {
230- Log .e ( TAG , "readBytesFromFile too big" );
231- return null ;
232- }
233- if ( size <= 0 ) {
234- Log .e ( TAG , "readBytesFromFile size unknown" );
229+ if ( size <= 0 || size > Integer .MAX_VALUE ) {
230+ Log .e ( TAG , "readBytesFromFile error - size" );
235231 return null ;
236232 }
237233 FileInputStream is = new FileInputStream ( file );
@@ -249,12 +245,8 @@ public static byte[] readBytesFromUri( Uri uri, Context ctx) {
249245 byte [] bytes = null ;
250246 try {
251247 long size = fileSizeFromUri ( uri , ctx );
252- if ( size > Integer .MAX_VALUE ) {
253- Log .e ( TAG , "readBytesFromUri too big" );
254- return null ;
255- }
256- if ( size <= 0 ) {
257- Log .e ( TAG , "readBytesFromUri size unknown" );
248+ if ( size <= 0 || size > Integer .MAX_VALUE ) {
249+ Log .e ( TAG , "readBytesFromUri error - size" );
258250 return null ;
259251 }
260252 InputStream is = ctx .getContentResolver ().openInputStream ( uri );
You can’t perform that action at this time.
0 commit comments