fix: 修复基建排版表数量为为0时引起的崩溃问题

This commit is contained in:
SherkeyXD
2024-07-22 10:41:03 +08:00
parent 5b1d8b2805
commit 423a37bfbb

View File

@@ -2645,6 +2645,11 @@ namespace MaaWpfGui.ViewModels.UI
{
get
{
if (CustomInfrastPlanInfoList.Count == 0)
{
return 0;
}
if (_customInfrastPlanIndex >= CustomInfrastPlanInfoList.Count || _customInfrastPlanIndex < 0)
{
CustomInfrastPlanIndex = _customInfrastPlanIndex;
@@ -2654,7 +2659,11 @@ namespace MaaWpfGui.ViewModels.UI
}
set
{
if (value >= CustomInfrastPlanInfoList.Count || value < 0)
if (CustomInfrastPlanInfoList.Count == 0)
{
value = 0;
}
else if (value >= CustomInfrastPlanInfoList.Count || value < 0)
{
var count = CustomInfrastPlanInfoList.Count;
value = (value % count + count) % count;