fix(YouTube): Check if protobufBuffer can be filtered

An `UnsupportedOperationException` exception would be thrown in `LithoFilterParameters#LithoFilterParameters` if this buffer is not backed by an accessible array
This commit is contained in:
oSumAtrIX 2023-11-18 19:18:13 +01:00
parent 46bfeea1a3
commit b078f0ca37
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -489,10 +489,11 @@ public final class LithoFilterPatch {
return false;
ByteBuffer protobufBuffer = bufferThreadLocal.get();
if (protobufBuffer == null) {
LogHelper.printException(() -> "Proto buffer is null"); // Should never happen
if (protobufBuffer == null || !protobufBuffer.hasArray()) {
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);