mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-07 10:43:48 +00:00
Merge pull request #3480 from wb9688/update-nanojson
Use our nanojson fork
This commit is contained in:
@@ -74,14 +74,16 @@ public final class ImportExportJsonHelper {
|
||||
final List<SubscriptionItem> channels = new ArrayList<>();
|
||||
|
||||
try {
|
||||
JsonObject parentObject = JsonParser.object().from(in);
|
||||
JsonArray channelsArray = parentObject.getArray(JSON_SUBSCRIPTIONS_ARRAY_KEY);
|
||||
if (eventListener != null) {
|
||||
eventListener.onSizeReceived(channelsArray.size());
|
||||
final JsonObject parentObject = JsonParser.object().from(in);
|
||||
|
||||
if (!parentObject.has(JSON_SUBSCRIPTIONS_ARRAY_KEY)) {
|
||||
throw new InvalidSourceException("Channels array is null");
|
||||
}
|
||||
|
||||
if (channelsArray == null) {
|
||||
throw new InvalidSourceException("Channels array is null");
|
||||
final JsonArray channelsArray = parentObject.getArray(JSON_SUBSCRIPTIONS_ARRAY_KEY);
|
||||
|
||||
if (eventListener != null) {
|
||||
eventListener.onSizeReceived(channelsArray.size());
|
||||
}
|
||||
|
||||
for (Object o : channelsArray) {
|
||||
|
||||
@@ -51,13 +51,14 @@ public final class TabsJsonHelper {
|
||||
final JsonObject outerJsonObject;
|
||||
try {
|
||||
outerJsonObject = JsonParser.object().from(tabsJson);
|
||||
final JsonArray tabsArray = outerJsonObject.getArray(JSON_TABS_ARRAY_KEY);
|
||||
|
||||
if (tabsArray == null) {
|
||||
if (!outerJsonObject.has(JSON_TABS_ARRAY_KEY)) {
|
||||
throw new InvalidJsonException("JSON doesn't contain \"" + JSON_TABS_ARRAY_KEY
|
||||
+ "\" array");
|
||||
}
|
||||
|
||||
final JsonArray tabsArray = outerJsonObject.getArray(JSON_TABS_ARRAY_KEY);
|
||||
|
||||
for (Object o : tabsArray) {
|
||||
if (!(o instanceof JsonObject)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user