提交 0d01ae98 编写于 作者: C CyrusNajmabadi

Be resilient to null-paths/names for Documents/Projects in SqlitePersistence layer.

上级 bedaa5e6
...@@ -202,6 +202,11 @@ string GetDocumentIdString(Document document) ...@@ -202,6 +202,11 @@ string GetDocumentIdString(Document document)
void AddIfUnknownId(string value, HashSet<string> stringsToAdd) void AddIfUnknownId(string value, HashSet<string> stringsToAdd)
{ {
if (value == null)
{
return;
}
if (!_stringToIdMap.TryGetValue(value, out var id)) if (!_stringToIdMap.TryGetValue(value, out var id))
{ {
stringsToAdd.Add(value); stringsToAdd.Add(value);
......
...@@ -34,6 +34,11 @@ private void FetchStringTable(SqlConnection connection) ...@@ -34,6 +34,11 @@ private void FetchStringTable(SqlConnection connection)
private int? TryGetStringId(SqlConnection connection, string value) private int? TryGetStringId(SqlConnection connection, string value)
{ {
if (value == null)
{
return null;
}
// First see if we've cached the ID for this value locally. If so, just return // First see if we've cached the ID for this value locally. If so, just return
// what we already have. // what we already have.
if (_stringToIdMap.TryGetValue(value, out int existingId)) if (_stringToIdMap.TryGetValue(value, out int existingId))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册