Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit b27a524

Browse files
xieofxiebobokids
authored andcommitted
[Weather] use IsNaN instead of comparison (#2588)
1 parent f12a7c2 commit b27a524

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

skills/csharp/experimental/weatherskill/Dialogs/ForecastDialog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private async Task<DialogTurnResult> RouteToGeographyPromptOrForecastResponse(Wa
6666
var state = await _stateAccessor.GetAsync(stepContext.Context);
6767
var geography = state.Geography;
6868

69-
if (string.IsNullOrEmpty(geography) && state.Latitude == double.NaN)
69+
if (string.IsNullOrEmpty(geography) && double.IsNaN(state.Latitude))
7070
{
7171
return await stepContext.NextAsync();
7272
}
@@ -122,7 +122,7 @@ private async Task<DialogTurnResult> GetWeatherResponse(WaterfallStepContext ste
122122
{
123123
state.GeographyLocation = await service.GetLocationByQueryAsync(state.Geography);
124124
}
125-
else if (state.Latitude != double.NaN)
125+
else if (!double.IsNaN(state.Latitude))
126126
{
127127
state.GeographyLocation = await service.GetLocationByGeoAsync(state.Latitude, state.Longitude);
128128
}

skills/csharp/experimental/weatherskill/Models/SkillState.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ namespace WeatherSkill.Models
77
{
88
public class SkillState
99
{
10+
public SkillState()
11+
{
12+
Clear();
13+
}
14+
1015
public string Token { get; internal set; }
1116

1217
public WeatherSkillLuis LuisResult { get; internal set; }

0 commit comments

Comments
 (0)