Skip to content

Commit f188199

Browse files
pekingmehunterstich
authored andcommitted
[Color] Internal cleanup.
PiperOrigin-RevId: 538268914
1 parent 836c51e commit f188199

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/java/com/google/android/material/color/ColorResourcesLoaderCreator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)