[Scummvm-git-logs] scummvm-web master -> 684e3e9ca7dfc419b277d428380dbaa6c3956c11

Thunderforge noreply at scummvm.org
Sat Nov 27 18:11:47 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
684e3e9ca7 WEB: Fixing the Games page not loading


Commit: 684e3e9ca7dfc419b277d428380dbaa6c3956c11
    https://github.com/scummvm/scummvm-web/commit/684e3e9ca7dfc419b277d428380dbaa6c3956c11
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2021-11-27T12:11:43-06:00

Commit Message:
WEB: Fixing the Games page not loading

Game items don't have a getVersion() method. Now we check for it before we try to sort.

Changed paths:
    include/Objects/DownloadsSection.php


diff --git a/include/Objects/DownloadsSection.php b/include/Objects/DownloadsSection.php
index e3a255d5..6f91469d 100644
--- a/include/Objects/DownloadsSection.php
+++ b/include/Objects/DownloadsSection.php
@@ -29,8 +29,8 @@ class DownloadsSection extends BasicSection
     {
         if ($item->getCategoryIcon()) {
             $this->items[] = new File($item->toArray(TableMap::TYPE_FIELDNAME), '');
-            // If this item is an old version, sort all items by version, descending
-            if ($item->getVersion() !== RELEASE && $item->getVersion() !== 'Daily') {
+            // If this item is for an old version, sort all items by version, descending
+            if ($this->hasOldVersion($item)) {
                 usort($this->items, function ($a, $b) {
                     return -version_compare($a->version, $b->version);
                 });
@@ -61,4 +61,9 @@ class DownloadsSection extends BasicSection
     {
         $this->subsections[$section->getAnchor()] = $section;
     }
+
+    private function hasOldVersion($item)
+    {
+        return method_exists($item, 'getVersion') && $item->getVersion() !== RELEASE && $item->getVersion() !== 'Daily';
+    }
 }




More information about the Scummvm-git-logs mailing list