joshcai / leetcode-sync

GitHub Action for syncing LeetCode submissions to GitHub
303 stars 61 forks source link

Fix for fetching submission info when runtime or memory percentile is null #63

Closed jaspinderkohli closed 4 months ago

jaspinderkohli commented 4 months ago

Fix for fetching submission info when runtime or memory percentile is null

Description

This pull request addresses an issue where fetching submission info results in a TypeError when either the runtime or memory percentile is null. The error occurs because the toFixed method is called on a null value, causing the script to crash.

Issue

The issue was reported in the following error message:

Root Cause

The root cause of this issue is that the getInfo function does not correctly handle cases where the runtimePercentile or memoryPercentile properties are null. When these values are null, calling the toFixed method on them results in a TypeError.

Fix

The fix involves adding a check to ensure that the runtimePercentile and memoryPercentile properties are not null or undefined before calling the toFixed method. If these properties are null or undefined, the function will return "N/A" instead.

Addresses

This fix addresses issue #58

joshcai commented 4 months ago

Thank you for the fix and the detailed PR description! LGTM so will merge.