From 4ebfba76a3ec73848b7e9c0ed0f5cd2d3eaf337d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Sun, 18 Oct 2020 11:46:56 +0800 Subject: [PATCH] using ContainKey instead of getvalueofdefault --- Flow.Launcher.Infrastructure/Alphabet.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Alphabet.cs b/Flow.Launcher.Infrastructure/Alphabet.cs index eda9caaae..d0e496a2c 100644 --- a/Flow.Launcher.Infrastructure/Alphabet.cs +++ b/Flow.Launcher.Infrastructure/Alphabet.cs @@ -32,21 +32,20 @@ namespace Flow.Launcher.Infrastructure { if (_settings.ShouldUsePinyin) { - string result = _pinyinCache.GetValueOrDefault(content); - if (result == null) + if (_pinyinCache.ContainsKey(content)) { if (WordsHelper.HasChinese(content)) { - result = WordsHelper.GetPinyin(content,";"); + var result = WordsHelper.GetPinyin(content,";"); result = GetFirstPinyinChar(result) + result.Replace(";",""); _pinyinCache[content] = result; + return result; } else { - result = content; + return content; } } - return result; } else {