Skip to content

Commit 276a825

Browse files
committed
Wonderful bug fix
1 parent f8e5ba4 commit 276a825

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.1.7
2+
- Fix a Cocos2d-x 2.2.3 bug where for some godforsaken reason, autorelease can be called on a nullptr in CCDictionary::createWithContentsOfFile. Thank you cocos devs :)
3+
14
# 1.1.6
25
- iOS rebuild
36
- New icon

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "4.6.1",
2+
"geode": "4.6.2",
33
"gd": {
44
"win": "2.2074",
55
"android": "2.2074",
@@ -8,7 +8,7 @@
88
},
99
"id": "alphalaneous.alphas_geode_utils",
1010
"name": "Alpha's Geode Utils",
11-
"version": "v1.1.6",
11+
"version": "v1.1.7",
1212
"developer": "Alphalaneous",
1313
"description": "Miscellaneous utilities for Geode Modding",
1414
"api": {

src/hooks/CCDictionary.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <Geode/Geode.hpp>
2+
#include <Geode/modify/CCDictionary.hpp>
3+
4+
using namespace geode::prelude;
5+
6+
class $modify(CCDictionary) {
7+
8+
// Cocos will call autorelease on a nullptr here for some reason,
9+
// it doesn't crash due to no member access but will crash with this
10+
// mod since I access m_nLuaID
11+
12+
static CCDictionary* createWithContentsOfFile(const char *pFileName) {
13+
if (auto ret = CCDictionary::createWithContentsOfFileThreadSafe(pFileName)) {
14+
ret->autorelease();
15+
return ret;
16+
}
17+
18+
return nullptr;
19+
}
20+
};

0 commit comments

Comments
 (0)