Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
houseofcat committed Apr 22, 2024
1 parent 4b19f52 commit ad2a888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace HouseofCat.Database.Dapper;

public partial class GeometryPointTypeHandler : SqlMapper.TypeHandler<GeometryPoint>
{
[GeneratedRegex(@"^(POINT \()(.+)(\))", RegexOptions.CultureInvariant)]
[GeneratedRegex(@"^(POINT \()(.+)(\))", RegexOptions.IgnoreCase)]
private static partial Regex PointRegex();
private static readonly Regex _regex = PointRegex();

Expand All @@ -19,7 +19,7 @@ public override GeometryPoint Parse(object value)
if (!_regex.IsMatch(value.ToString()))
{ throw new ArgumentException("Value is not a Geometry Point"); }

var geometryPoints = value.ToString().Split('(', ')')[1];
var geometryPoints = value.ToString().Split('(', ')', StringSplitOptions.RemoveEmptyEntries)[1];
var geometryValues = geometryPoints.Split(' ');

var x = ConvertToDouble(geometryValues[0]);
Expand Down
3 changes: 2 additions & 1 deletion src/HouseofCat.Dataflows/DataflowEngine.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using HouseofCat.Utilities.Helpers;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;

Expand Down Expand Up @@ -75,7 +76,7 @@ protected virtual async Task ExecuteWorkBodyAsync(TIn data)
if (_postWorkBodyAsync != null)
{
var output = await _workBodyAsync(data).ConfigureAwait(false);
if (output != null)
if (!EqualityComparer<TIn>.Default.Equals(data, default))
{
await _postWorkBodyAsync(output).ConfigureAwait(false);
}
Expand Down

0 comments on commit ad2a888

Please sign in to comment.