From bccc16b269c0a5020c2dc748c15d956ae774db33 Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Tue, 14 Sep 2021 14:16:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=8E=86=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lunarcalendarwidget/lunarcalendarinfo.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lunarcalendarwidget/lunarcalendarinfo.cpp b/lunarcalendarwidget/lunarcalendarinfo.cpp index e985081..a4073c6 100644 --- a/lunarcalendarwidget/lunarcalendarinfo.cpp +++ b/lunarcalendarwidget/lunarcalendarinfo.cpp @@ -440,17 +440,19 @@ QString LunarCalendarInfo::getSolarTerms(int year, int month, int day) { QString strSolarTerms; int dayTemp = 0; + //24节气对应表在1970年以后指定? int index = (year - 1970) * 12 + month - 1; + if (index < 0) { + return ""; + } if (day < 15) { dayTemp = 15 - day; - if ((chineseTwentyFourData.at(index) >> 4) == dayTemp) { strSolarTerms = listSolarTerm.at(2 * (month - 1)); } } else if (day > 15) { dayTemp = day - 15; - if ((chineseTwentyFourData.at(index) & 0x0f) == dayTemp) { strSolarTerms = listSolarTerm.at(2 * (month - 1) + 1); }