Skip to content

Commit 96b68fe

Browse files
committed
Add a check for filtering negative values and returning 0
1 parent f671387 commit 96b68fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/platform/Darwin/UserDefaults.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ uint16_t getUserDefaultDnssdSRPTimeoutInMSecs()
2727
{
2828
NSUserDefaults * defaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultDomain];
2929
NSInteger srpTimeoutValue = [defaults integerForKey:kSRPTimeoutInMsecsUserDefaultKey];
30-
return (srpTimeoutValue < UINT16_MAX) ? static_cast<uint16_t>(srpTimeoutValue) : 0;
30+
return (srpTimeoutValue > 0 && srpTimeoutValue < UINT16_MAX) ? static_cast<uint16_t>(srpTimeoutValue) : 0;
3131
}
3232

3333
} // namespace DeviceLayer

0 commit comments

Comments
 (0)