Skip to content

Commit ec9adf8

Browse files
soloturnCervator
authored andcommitted
do not exist for unexpected exceptions
1 parent 4e12a75 commit ec9adf8

File tree

1 file changed

+39
-34
lines changed

1 file changed

+39
-34
lines changed

engine/src/main/java/org/terasology/engine/core/TerasologyEngine.java

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -486,52 +486,57 @@ public boolean tick() {
486486
return false;
487487
}
488488

489-
if (assetTypeManager instanceof AutoReloadAssetTypeManager) {
490-
try {
491-
((AutoReloadAssetTypeManager) assetTypeManager).reloadChangedAssets();
492-
} catch (IllegalStateException ignore) {
493-
// ignore: This can happen if a module environment switch is happening in a different thread.
494-
return true;
489+
try {
490+
if (assetTypeManager instanceof AutoReloadAssetTypeManager) {
491+
try {
492+
((AutoReloadAssetTypeManager) assetTypeManager).reloadChangedAssets();
493+
} catch (IllegalStateException ignore) {
494+
// ignore: This can happen if a module environment switch is happening in a different thread.
495+
return true;
496+
}
495497
}
496-
}
497498

498-
processPendingState();
499+
processPendingState();
499500

500-
if (currentState == null) {
501-
shutdown();
502-
return false;
503-
}
501+
if (currentState == null) {
502+
shutdown();
503+
return false;
504+
}
504505

505-
Iterator<Float> updateCycles = timeSubsystem.getEngineTime().tick();
506-
CoreRegistry.setContext(currentState.getContext());
507-
rootContext.get(NetworkSystem.class).setContext(currentState.getContext());
506+
Iterator<Float> updateCycles = timeSubsystem.getEngineTime().tick();
507+
CoreRegistry.setContext(currentState.getContext());
508+
rootContext.get(NetworkSystem.class).setContext(currentState.getContext());
508509

509-
for (EngineSubsystem subsystem : allSubsystems) {
510-
try (Activity ignored = PerformanceMonitor.startActivity(subsystem.getName() + " PreUpdate")) {
511-
subsystem.preUpdate(currentState, timeSubsystem.getEngineTime().getRealDelta());
510+
for (EngineSubsystem subsystem : allSubsystems) {
511+
try (Activity ignored = PerformanceMonitor.startActivity(subsystem.getName() + " PreUpdate")) {
512+
subsystem.preUpdate(currentState, timeSubsystem.getEngineTime().getRealDelta());
513+
}
512514
}
513-
}
514515

515-
while (updateCycles.hasNext()) {
516-
float updateDelta = updateCycles.next(); // gameTime gets updated here!
517-
try (Activity ignored = PerformanceMonitor.startActivity("Main Update")) {
518-
currentState.update(updateDelta);
516+
while (updateCycles.hasNext()) {
517+
float updateDelta = updateCycles.next(); // gameTime gets updated here!
518+
try (Activity ignored = PerformanceMonitor.startActivity("Main Update")) {
519+
currentState.update(updateDelta);
520+
}
519521
}
520-
}
521522

522-
// Waiting processes are set by modules via GameThread.a/synch() methods.
523-
GameThread.processWaitingProcesses();
523+
// Waiting processes are set by modules via GameThread.a/synch() methods.
524+
GameThread.processWaitingProcesses();
524525

525-
for (EngineSubsystem subsystem : getSubsystems()) {
526-
try (Activity ignored = PerformanceMonitor.startActivity(subsystem.getName() + " Subsystem postUpdate")) {
527-
subsystem.postUpdate(currentState, timeSubsystem.getEngineTime().getRealDelta());
526+
for (EngineSubsystem subsystem : getSubsystems()) {
527+
try (Activity ignored = PerformanceMonitor.startActivity(subsystem.getName() + " Subsystem postUpdate")) {
528+
subsystem.postUpdate(currentState, timeSubsystem.getEngineTime().getRealDelta());
529+
}
528530
}
531+
assetTypeManager.disposedUnusedAssets();
532+
533+
PerformanceMonitor.rollCycle();
534+
PerformanceMonitor.startActivity("Other");
535+
return true;
536+
} catch (Exception ignore) {
537+
ignore.printStackTrace();
538+
return true;
529539
}
530-
assetTypeManager.disposedUnusedAssets();
531-
532-
PerformanceMonitor.rollCycle();
533-
PerformanceMonitor.startActivity("Other");
534-
return true;
535540
}
536541

537542
public void cleanup() {

0 commit comments

Comments
 (0)