diff --git a/examples/miditranspose.nim b/examples/miditranspose.nim index da7b6ec..866621c 100644 --- a/examples/miditranspose.nim +++ b/examples/miditranspose.nim @@ -26,7 +26,8 @@ proc instantiate(descriptor: ptr Lv2Descriptor; sampleRate: cdouble; let amp: ptr MidiTransposePlugin = createShared(MidiTransposePlugin) amp.map = cast[ptr UridMap](lv2FeaturesData(features, lv2UridMap)) - if amp.map == nil: + if amp.map.isNil: + freeShared(amp) return nil amp.midi_urid = amp.map.map(amp.map.handle, lv2MidiMidiEvent) diff --git a/src/nymph/atom/util.nim b/src/nymph/atom/util.nim index eb1d9e6..2544820 100644 --- a/src/nymph/atom/util.nim +++ b/src/nymph/atom/util.nim @@ -31,7 +31,7 @@ proc atomTotalSize*(atom: ptr Atom): uint32 {.inline.} = ## Return true iff `atom` is null. ## proc atomIsNull*(atom: ptr Atom): bool {.inline.} = - return atom == nil or (atom.`type` == Urid(0) and atom.size == 0) + return atom.isNil or (atom.`type` == Urid(0) and atom.size == 0) ## ## Return true iff `a` is equal to `b`. diff --git a/src/nymph/util.nim b/src/nymph/util.nim index 74d65b2..2b287dc 100644 --- a/src/nymph/util.nim +++ b/src/nymph/util.nim @@ -7,11 +7,11 @@ import core ## present but have nil data. proc lv2FeaturesData*(features: ptr UncheckedArray[ptr Lv2Feature], uri: string): pointer = - if features != nil: + if not features.isNil: var i = 0 while true: let feature = features[i] - if feature == nil: + if feature.isNil: break if feature[].uri == uri.cstring: