SDL: Changed example code to avoid potential divide by zero

From 279ff8909f727e6b23f737dee7d0e8483abbcfac Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 8 Aug 2023 16:52:09 -0700
Subject: [PATCH] Changed example code to avoid potential divide by zero

---
 docs/README-migration.md | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/docs/README-migration.md b/docs/README-migration.md
index dc34559f9c25..ad10b0ec938c 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -925,8 +925,10 @@ should be changed to:

size_t custom_read(void *ptr, size_t size, size_t nitems, SDL_RWops *stream)
{

  • size_t bytes = SDL_RWread(stream, ptr, size * nitems);
  • return (bytes / size);
  • if (size > 0 && nitems > 0) {
  •    return SDL_RWread(stream, ptr, size * nitems) / size;
    
  • }
  • return 0;
    }