Skip to content

Commit 44e2bd5

Browse files
committed
Fix empty lines bug
When RawLines only has 1 point it can't make a line...
1 parent b12eed5 commit 44e2bd5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Sources/GateEngine/Resources/Geometry/Lines.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extension ResourceManager {
118118
let key = Cache.GeometryKey(requestedPath: path, kind: .lines, geometryOptions: .none)
119119
if cache.geometries[key] == nil {
120120
cache.geometries[key] = Cache.GeometryCache()
121-
if let lines = lines {
121+
if let lines = lines, lines.isEmpty == false {
122122
Game.unsafeShared.resourceManager.incrementLoading(path: key.requestedPath)
123123

124124
if let cache = self.cache.geometries[key] {

Sources/GateEngine/Resources/Geometry/Raw/RawLines.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public struct RawLines: Sendable {
1212
var indices: [UInt16]
1313

1414
public var isEmpty: Bool {
15-
return indices.isEmpty
15+
// If at least 2 points exists, then we have 1 line and are not empty
16+
return indices.count < 2
1617
}
1718

1819
public init() {

0 commit comments

Comments
 (0)