Skip to content

Commit

Permalink
fix(YouTube): Check if protobufBuffer can be filtered
Browse files Browse the repository at this point in the history
An `UnsupportedOperationException` exception would be thrown in `LithoFilterParameters#LithoFilterParameters` if this buffer is not backed by an accessible array
  • Loading branch information
oSumAtrIX committed Nov 18, 2023
1 parent 46bfeea commit b078f0c
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -489,10 +489,11 @@ public static boolean filter(@Nullable String lithoIdentifier, @NonNull StringBu
return false;

ByteBuffer protobufBuffer = bufferThreadLocal.get();
if (protobufBuffer == null) {
LogHelper.printException(() -> "Proto buffer is null"); // Should never happen
if (protobufBuffer == null || !protobufBuffer.hasArray()) {

This comment has been minimized.

Copy link
@LisoUseInAIKyrios

LisoUseInAIKyrios Nov 18, 2023

Contributor

Can the protobuffer not have an array during normal app usage? This logs as an exception so it'll show a toast.

This comment has been minimized.

Copy link
@oSumAtrIX

oSumAtrIX Nov 18, 2023

Author Member

Some users have encountered this log with the app crashing under normal app usage at launch of the app

This comment has been minimized.

Copy link
@LisoUseInAIKyrios

LisoUseInAIKyrios Nov 18, 2023

Contributor

If it's normal usage, then the logging should be debug so it doesn't show a toast.

This comment has been minimized.

Copy link
@oSumAtrIX

oSumAtrIX Nov 18, 2023

Author Member

This sounds reasonable.

LogHelper.printException(() -> "Proto buffer is null or has no array"); // Should never happen.
return false;
}

LithoFilterParameters parameter = new LithoFilterParameters(lithoIdentifier, pathBuilder, protobufBuffer);
LogHelper.printDebug(() -> "Searching " + parameter);

Expand Down

0 comments on commit b078f0c

Please sign in to comment.