Skip to content

Commit afef6a1

Browse files
committed
Fix NPE of CountUp
1 parent 9431d7c commit afef6a1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/app/components/common/number-grow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
* https://opensource.org/licenses/MIT
66
*/
77

8+
import type { Ref } from "vue"
9+
810
import { defineComponent, h, onMounted, ref, watch } from "vue"
911
import { CountUp } from "countup.js"
10-
import type { Ref } from "vue"
1112

1213
const _default = defineComponent({
1314
name: "NumberGrow",

src/app/components/dashboard/components/indicator/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ function renderBrowsingMinute(browsingMinute: number) {
123123
}
124124

125125
function renderMostUse(most2Hour: number) {
126-
const startHour = most2Hour * 2
127-
const endHour = most2Hour * 2 + 2
126+
const [startHour, endHour] = most2Hour === undefined || isNaN(most2Hour)
127+
? [0, 0]
128+
: [most2Hour * 2, most2Hour * 2 + 2]
129+
128130
const duration = 2.25
129131
return h('div',
130132
{ class: 'indicator-label' },

0 commit comments

Comments
 (0)