Skip to content

Commit 721035c

Browse files
committed
check strings null or empty with TryGetValue
1 parent 862e1e3 commit 721035c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ private void ModificationAdded(RegistryTraceData registryTraceData) {
15921592
if (kcbModificationKeyNames != null) {
15931593
kcbModificationKeyNames.TryGetValue(safeKeyHandle, out string kcbModificationKeyName);
15941594

1595-
if (kcbModificationKeyName != null) {
1595+
if (!String.IsNullOrEmpty(kcbModificationKeyName)) {
15961596
registryStateElement.KeyName = GetRedirectedKeyValueName(
15971597
GetKeyValueNameFromKernelRegistryString(kcbModificationKeyName + "\\" + registryStateElement.KeyName),
15981598
modificationsElement.RegistryStates.BinaryType
@@ -1713,7 +1713,7 @@ private void ModificationRemoved(RegistryTraceData registryTraceData) {
17131713
if (kcbModificationKeyNames != null) {
17141714
kcbModificationKeyNames.TryGetValue(safeKeyHandle, out string kcbModificationKeyName);
17151715

1716-
if (kcbModificationKeyName != null) {
1716+
if (!String.IsNullOrEmpty(kcbModificationKeyName)) {
17171717
// we have info from the handle already to get the name
17181718
registryStateElement.KeyName = GetRedirectedKeyValueName(
17191719
GetKeyValueNameFromKernelRegistryString(kcbModificationKeyName + "\\" + registryStateElement.KeyName),

FlashpointSecurePlayer/Shared.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ public string this[string longPath] {
19751975
get {
19761976
pathNamesShort.TryGetValue(longPath, out string pathNameShort);
19771977

1978-
if (pathNameShort != null) {
1978+
if (!String.IsNullOrEmpty(pathNameShort)) {
19791979
return pathNameShort;
19801980
}
19811981

@@ -1999,7 +1999,7 @@ public string this[string shortPath] {
19991999
get {
20002000
pathNamesLong.TryGetValue(shortPath, out string pathNameLong);
20012001

2002-
if (pathNameLong != null) {
2002+
if (!String.IsNullOrEmpty(pathNameLong)) {
20032003
return pathNameLong;
20042004
}
20052005

0 commit comments

Comments
 (0)