fix: bug - null reference for hidden accounts

This commit is contained in:
Mikhail Shabanov committed 2022-08-19 17:09:22 +02:00
1 parent bb16617f3f
commit 7d524fcdcd
7 files changed
+28 -38

No files matched your search

@@ -11,24 +11,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
return serializedValue switch
{
"NONE" => MarkOfMastery.None,
"RANK3" => MarkOfMastery.Rank3,
"RANK2" => MarkOfMastery.Rank2,
"RANK1" => MarkOfMastery.Rank1,
"MASTER" => MarkOfMastery.Master,
_ => throw new global::StrawberryShake.GraphQLClientException()};
"NONE" => MarkOfMastery.None, "RANK3" => MarkOfMastery.Rank3, "RANK2" => MarkOfMastery.Rank2, "RANK1" => MarkOfMastery.Rank1, "MASTER" => MarkOfMastery.Master, _ => throw new global::StrawberryShake.GraphQLClientException()}
;
}
public global::System.Object Format(global::System.Object? runtimeValue)
{
return runtimeValue switch
{
MarkOfMastery.None => "NONE",
MarkOfMastery.Rank3 => "RANK3",
MarkOfMastery.Rank2 => "RANK2",
MarkOfMastery.Rank1 => "RANK1",
MarkOfMastery.Master => "MASTER",
_ => throw new global::StrawberryShake.GraphQLClientException()};
MarkOfMastery.None => "NONE", MarkOfMastery.Rank3 => "RANK3", MarkOfMastery.Rank2 => "RANK2", MarkOfMastery.Rank1 => "RANK1", MarkOfMastery.Master => "MASTER", _ => throw new global::StrawberryShake.GraphQLClientException()}
;
}
}
}
@@ -11,22 +11,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
return serializedValue switch
{
"RU" => RealmType.Ru,
"EU" => RealmType.Eu,
"NA" => RealmType.Na,
"ASIA" => RealmType.Asia,
_ => throw new global::StrawberryShake.GraphQLClientException()};
"RU" => RealmType.Ru, "EU" => RealmType.Eu, "NA" => RealmType.Na, "ASIA" => RealmType.Asia, _ => throw new global::StrawberryShake.GraphQLClientException()}
;
}
public global::System.Object Format(global::System.Object? runtimeValue)
{
return runtimeValue switch
{
RealmType.Ru => "RU",
RealmType.Eu => "EU",
RealmType.Na => "NA",
RealmType.Asia => "ASIA",
_ => throw new global::StrawberryShake.GraphQLClientException()};
RealmType.Ru => "RU", RealmType.Eu => "EU", RealmType.Na => "NA", RealmType.Asia => "ASIA", _ => throw new global::StrawberryShake.GraphQLClientException()}
;
}
}
}
@@ -11,20 +11,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
{
return serializedValue switch
{
"RU" => RequestLanguage.Ru,
"EN" => RequestLanguage.En,
"DE" => RequestLanguage.De,
_ => throw new global::StrawberryShake.GraphQLClientException()};
"RU" => RequestLanguage.Ru, "EN" => RequestLanguage.En, "DE" => RequestLanguage.De, _ => throw new global::StrawberryShake.GraphQLClientException()}
;
}
public global::System.Object Format(global::System.Object? runtimeValue)
{
return runtimeValue switch
{
RequestLanguage.Ru => "RU",
RequestLanguage.En => "EN",
RequestLanguage.De => "DE",
_ => throw new global::StrawberryShake.GraphQLClientException()};
RequestLanguage.Ru => "RU", RequestLanguage.En => "EN", RequestLanguage.De => "DE", _ => throw new global::StrawberryShake.GraphQLClientException()}
;
}
}
}
@@ -13,16 +13,18 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
global::System.String __typename = obj.GetProperty("__typename").GetString()!;
return __typename switch
{
"Achievement" => ParseAchievementEntityId(obj, __typename),
_ => throw new global::System.NotSupportedException()};
"Achievement" => ParseAchievementEntityId(obj, __typename), _ => throw new global::System.NotSupportedException()}
;
}
public global::System.String Format(global::StrawberryShake.EntityId entityId)
{
return entityId.Name switch
{
"Achievement" => FormatAchievementEntityId(entityId),
_ => throw new global::System.NotSupportedException()};
"Achievement" => FormatAchievementEntityId(entityId), _ => throw new global::System.NotSupportedException()}
;
}
private global::StrawberryShake.EntityId ParseAchievementEntityId(global::System.Text.Json.JsonElement obj, global::System.String type)
@@ -6,7 +6,7 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl.State
[global::System.CodeDom.Compiler.GeneratedCode("StrawberryShake", "11.2.2.0")]
public partial class WotBlitzStatisticsProClientStoreAccessor : global::StrawberryShake.StoreAccessor
{
public WotBlitzStatisticsProClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories) : base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
public WotBlitzStatisticsProClientStoreAccessor(global::StrawberryShake.IOperationStore operationStore, global::StrawberryShake.IEntityStore entityStore, global::StrawberryShake.IEntityIdSerializer entityIdSerializer, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationRequestFactory> requestFactories, global::System.Collections.Generic.IEnumerable<global::StrawberryShake.IOperationResultDataFactory> resultDataFactories): base(operationStore, entityStore, entityIdSerializer, requestFactories, resultDataFactories)
{
}
}
+2 -2
View File
@@ -55,11 +55,11 @@ namespace WotBlitzStatisticsPro.Blazor
//var useMock = Environment.GetEnvironmentVariable("USE_GRAPH_QL_MOCK");
//if (useMock != null && useMock == "true")
//{
builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendMockService>();
//builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendMockService>();
//}
//else
//{
// builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendService>();
builder.Services.AddTransient<IGraphQlBackendService, GraphQlBackendService>();
//}
var host = builder.Build();
@@ -54,7 +54,7 @@ namespace WotBlitzStatisticsPro.Logic
for (int i = 0; i < accounts.Count; i++)
{
var accountResponse = accounts.ToArray()[i];
var shortAccountInfo = shortAccountInfos?.FirstOrDefault(a => a.AccountId == accountResponse.AccountId);
var shortAccountInfo = shortAccountInfos?.FirstOrDefault(a => a != null && a.AccountId == accountResponse.AccountId);
if (shortAccountInfo != null)
{
_mapper.Map(shortAccountInfo, accountResponse);