[ox] Fix TypeDescWriter segfault
This commit is contained in:
parent
a0c8146396
commit
72dddcaee5
6
deps/ox/src/ox/model/descwrite.hpp
vendored
6
deps/ox/src/ox/model/descwrite.hpp
vendored
@ -219,9 +219,11 @@ template<typename T>
|
|||||||
constexpr Error TypeDescWriter::field(CRStringView name, const T *val) noexcept {
|
constexpr Error TypeDescWriter::field(CRStringView name, const T *val) noexcept {
|
||||||
if (m_type) {
|
if (m_type) {
|
||||||
if constexpr(isVector_v<T> || isArray_v<T>) {
|
if constexpr(isVector_v<T> || isArray_v<T>) {
|
||||||
return field(name, val->data(), 0, detail::buildSubscriptStack(val));
|
typename T::value_type *data = nullptr;
|
||||||
|
return field(name, data, 0, detail::buildSubscriptStack(val));
|
||||||
} else if constexpr(isSmartPtr_v<T>) {
|
} else if constexpr(isSmartPtr_v<T>) {
|
||||||
return field(name, val->get(), 0, detail::buildSubscriptStack(val));
|
typename T::value_type *data = nullptr;
|
||||||
|
return field(name, data, 0, detail::buildSubscriptStack(val));
|
||||||
} else if constexpr(is_pointer_v<T>) {
|
} else if constexpr(is_pointer_v<T>) {
|
||||||
return field(name, val, 0, detail::buildSubscriptStack(val));
|
return field(name, val, 0, detail::buildSubscriptStack(val));
|
||||||
} else {
|
} else {
|
||||||
|
2
deps/ox/src/ox/std/memory.hpp
vendored
2
deps/ox/src/ox/std/memory.hpp
vendored
@ -74,6 +74,7 @@ class SharedPtr {
|
|||||||
int *m_refCnt = nullptr;
|
int *m_refCnt = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using value_type = T;
|
||||||
explicit constexpr SharedPtr(T *t = nullptr) noexcept: m_t(t), m_refCnt(new int) {
|
explicit constexpr SharedPtr(T *t = nullptr) noexcept: m_t(t), m_refCnt(new int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,6 +184,7 @@ class UniquePtr {
|
|||||||
T *m_t = nullptr;
|
T *m_t = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using value_type = T;
|
||||||
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
explicit constexpr UniquePtr(T *t = nullptr) noexcept: m_t(t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user