# SDL: examples/demo/04-bytepusher: No need to check NULL before destroying things.

**URL:** <https://discourse.libsdl.org/t/sdl-examples-demo-04-bytepusher-no-need-to-check-null-before-destroying-things/55653>\
**Category:** SDL Commits\
**Created:** [November 22, 2024, 10:12pm UTC](https://discourse.libsdl.org/t/sdl-examples-demo-04-bytepusher-no-need-to-check-null-before-destroying-things/55653 "2024-11-22T22:12:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [November 22, 2024, 10:12pm UTC](https://discourse.libsdl.org/t/sdl-examples-demo-04-bytepusher-no-need-to-check-null-before-destroying-things/55653/1 "2024-11-22T22:12:47Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/f9ddb0bdea93b31822d5bf15f0125882799b3cfc>

```diff
From f9ddb0bdea93b31822d5bf15f0125882799b3cfc Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 22 Nov 2024 17:12:14 -0500
Subject: [PATCH] examples/demo/04-bytepusher: No need to check NULL before
 destroying things.

---
 examples/demo/04-bytepusher/bytepusher.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/examples/demo/04-bytepusher/bytepusher.c b/examples/demo/04-bytepusher/bytepusher.c
index 36f16fb02c20f..ae862908844e1 100644
--- a/examples/demo/04-bytepusher/bytepusher.c
+++ b/examples/demo/04-bytepusher/bytepusher.c
@@ -405,24 +405,12 @@ void SDL_AppQuit(void* appstate, SDL_AppResult result) {
     }
     if (appstate) {
         BytePusher* vm = (BytePusher*)appstate;
- if (vm->audiostream) {
- SDL_DestroyAudioStream(vm->audiostream);
- }
- if (vm->rendertarget) {
- SDL_DestroyTexture(vm->rendertarget);
- }
- if (vm->screentex) {
- SDL_DestroyTexture(vm->screentex);
- }
- if (vm->screen) {
- SDL_DestroySurface(vm->screen);
- }
- if (vm->renderer) {
- SDL_DestroyRenderer(vm->renderer);
- }
- if (vm->window) {
- SDL_DestroyWindow(vm->window);
- }
+ SDL_DestroyAudioStream(vm->audiostream);
+ SDL_DestroyTexture(vm->rendertarget);
+ SDL_DestroyTexture(vm->screentex);
+ SDL_DestroySurface(vm->screen);
+ SDL_DestroyRenderer(vm->renderer);
+ SDL_DestroyWindow(vm->window);
         SDL_free(vm);
     }
 }

```
