summaryrefslogtreecommitdiff
path: root/Tweak.xm
diff options
context:
space:
mode:
Diffstat (limited to 'Tweak.xm')
-rw-r--r--Tweak.xm10
1 files changed, 6 insertions, 4 deletions
diff --git a/Tweak.xm b/Tweak.xm
index 19d82b1..a8fa66c 100644
--- a/Tweak.xm
+++ b/Tweak.xm
@@ -29,10 +29,10 @@
// Because compiler is optimizing out checks for dereferenced null pointers
template <typename Type_>
-static inline Type_ &MYHookIvar(id self, const char *name) {
+static void MYHookIvar(id self, const char *name, Type_ *ivar_p) {
Ivar ivar(class_getInstanceVariable(object_getClass(self), name));
void *value = ivar == NULL ? NULL : *reinterpret_cast<void **>(reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
- return *(reinterpret_cast<Type_ *>(&value));
+ *ivar_p = reinterpret_cast<Type_>(value);
}
@@ -334,8 +334,10 @@ static void AlertIfNeeded() {
%hook SBUIController
- (id) init {
if ((self = %orig()) != nil) {
- UIView *_contentLayer = MYHookIvar<UIView *>(self, "_contentLayer");
- UIView *_contentView = MYHookIvar<UIView *>(self, "_contentView");
+ UIView *_contentLayer;
+ MYHookIvar<UIView *>(self, "_contentLayer", &_contentLayer);
+ UIView *_contentView;
+ MYHookIvar<UIView *>(self, "_contentView", &_contentView);
UIView *layer;
if (_contentLayer != NULL)