File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
lib/java/com/google/android/material/color Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ final class ColorResourcesLoaderCreator {
3737
3838 private ColorResourcesLoaderCreator () {}
3939
40- private static final String TAG = ColorResourcesLoaderCreator . class . getSimpleName () ;
40+ private static final String TAG = "ColorResLoaderCreator" ;
4141
4242 @ Nullable
4343 static ResourcesLoader create (
@@ -51,6 +51,11 @@ static ResourcesLoader create(
5151 FileDescriptor arscFile = null ;
5252 try {
5353 arscFile = Os .memfd_create ("temp.arsc" , /* flags= */ 0 );
54+ if (arscFile == null ) {
55+ // For robolectric tests, memfd_create will return null without ErrnoException.
56+ Log .w (TAG , "Cannot create memory file descriptor." );
57+ return null ;
58+ }
5459 // Note: This must not be closed through the OutputStream.
5560 try (OutputStream pipeWriter = new FileOutputStream (arscFile )) {
5661 pipeWriter .write (contentBytes );
You can’t perform that action at this time.
0 commit comments