Skip to content

Commit 7abe5e1

Browse files
authored
Don't crash if data is null, do nothing
1 parent ccdbd59 commit 7abe5e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Animation/GameObjectTrackController.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void GameObjectTrackController::Awake() {
4646

4747
void GameObjectTrackController::Start() {
4848
CJDLogger::Logger.fmtLog<Paper::LogLevel::INF>("Checking data {}", fmt::ptr(data));
49-
CRASH_UNLESS(data);
49+
// CRASH_UNLESS(data);
5050
}
5151

5252
void GameObjectTrackController::OnDestroy() {
@@ -77,19 +77,19 @@ void GameObjectTrackController::UpdateData(bool force) {
7777
if (!data) {
7878

7979
// Wait once just in case
80-
if (attemptedTries > 1) {
80+
if (attemptedTries > 1 && attemptedTries < 10) {
8181
CJDLogger::Logger.fmtLog<Paper::LogLevel::ERR>(
8282
"Data is null! Should remove component or just early return? {} {}", fmt::ptr(this),
8383
static_cast<std::string>(get_gameObject()->get_name()));
8484
}
85-
86-
CJDLogger::Logger.Backtrace(10);
85+
8786
// Destroy the object if the data is never found
8887
if (attemptedTries > 100) {
8988
CJDLogger::Logger.fmtLog<Paper::LogLevel::ERR>(
9089
"Destroying object", fmt::ptr(this),
9190
static_cast<std::string>(get_gameObject()->get_name()));
9291
Destroy(this);
92+
CJDLogger::Logger.Backtrace(10);
9393
} else {
9494
attemptedTries++;
9595
}

0 commit comments

Comments
 (0)