Skip to content

Commit 9793d2f

Browse files
committed
.NET: Fix enum fields not being settable
1 parent 528687a commit 9793d2f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

csharp-api/REFrameworkNET/Field.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace REFrameworkNET {
4848
return;
4949
}
5050

51-
const auto field_type = this->GetType();
51+
auto field_type = this->GetType();
5252

5353
if (field_type == nullptr) {
5454
return;
@@ -92,8 +92,14 @@ namespace REFrameworkNET {
9292
return; // Don't think there's any other way to set a reference type
9393
}
9494

95+
auto underlying_type = field_type->GetUnderlyingType();
96+
97+
// For enums
98+
if (underlying_type != nullptr) {
99+
field_type = underlying_type;
100+
}
101+
95102
const uintptr_t addr = IsStatic() ? 0 : obj;
96-
const auto vm_obj_type = field_type->GetVMObjType();
97103

98104
#define MAKE_TYPE_HANDLER_SET(X, Y) \
99105
case ##X##_fnv: \

0 commit comments

Comments
 (0)