Skip to content

Commit 17f63da

Browse files
authored
Merge pull request #1033 from JuliaRobotics/23Q3/enh/betterdata
better data handling
2 parents 8756d25 + ade35e3 commit 17f63da

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/DataBlobs/services/BlobPacking.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ function unpackBlob(::Type{format"JSON"}, blob::Vector{UInt8})
5151
return String(copy(blob))
5252
end
5353

54+
unpackBlob(entry::BlobEntry, blob::Vector{UInt8}) = unpackBlob(entry.mimeType, blob)
55+
unpackBlob(eb::Pair{<:BlobEntry, Vector{UInt8}}) = unpackBlob(eb[1], eb[2])
56+
5457

5558
# 2/ FileIO
5659
function packBlob(::Type{T}, data::Any; kwargs...) where T <: DataFormat

src/DataBlobs/services/HelpersDataWrapEntryBlob.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ function getData(
9292
lbls = (s->s.label).(de_)
9393
idx = sortperm(lbls; rev=getlast)
9494
_first(s) = s
95-
_first(s::AbstractVector) = s[1]
95+
_first(s::AbstractVector) = 0 < length(s) ? s[1] : nothing
9696
de = _first(de_[idx])
97+
if isnothing(de)
98+
@error "Could not find in $vlabel the key $key"
99+
return nothing
100+
end
97101
db = getBlob(dfg, de)
98102

99103
checkhash && assertHash(de, db, hashfunction=hashfunction)

0 commit comments

Comments
 (0)