[Scummvm-git-logs] scummvm master -> 945030ae2c2edacb4345bfd846979269c79adbb7

Strangerke noreply at scummvm.org
Wed Mar 9 21:17:15 UTC 2022


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

Summary:
945030ae2c CHEWY: rework checks on TXT_MARK_LOOK in ats_get_txt (also fix coverity 1475955)


Commit: 945030ae2c2edacb4345bfd846979269c79adbb7
    https://github.com/scummvm/scummvm/commit/945030ae2c2edacb4345bfd846979269c79adbb7
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2022-03-09T22:17:07+01:00

Commit Message:
CHEWY: rework checks on TXT_MARK_LOOK in ats_get_txt (also fix coverity 1475955)

Changed paths:
    engines/chewy/atds.cpp


diff --git a/engines/chewy/atds.cpp b/engines/chewy/atds.cpp
index ed9a3b5a347..649acee3a44 100644
--- a/engines/chewy/atds.cpp
+++ b/engines/chewy/atds.cpp
@@ -694,18 +694,28 @@ char *Atdsys::ats_get_txt(int16 txt_nr, int16 txt_mode, int16 *txt_anz, int16 mo
 	}
 
 	// WORKAROUND: Proper word wrapping some inventory items' look desc
-	if (txt_mode == TXT_MARK_LOOK) {
-		if (txt_nr == CYB_KRONE_INV && str_[37] == ' ' && str_[56] == '\0') {
-			str_[37] = '\0';
-			str_[56] = ' ';
-		}
-		if (txt_nr == YEL_CARD_INV && str_[39] == ' ' && str_[46] == '\0') {
-			str_[39] = '\0';
-			str_[46] = ' ';
-		}
-		if (txt_nr == PAPIER_INV && str_[32] == ' ') {
-			str_[32] = '\0';
-			*txt_anz = 2;
+	if (txt_mode == TXT_MARK_LOOK && str_ != nullptr) {
+		switch (txt_nr) {
+		case CYB_KRONE_INV:
+			if (str_[37] == ' ' && str_[56] == '\0') {
+				str_[37] = '\0';
+				str_[56] = ' ';
+			}
+			break;
+		case YEL_CARD_INV:
+			if (str_[39] == ' ' && str_[46] == '\0') {
+				str_[39] = '\0';
+				str_[46] = ' ';
+			}
+			break;
+		case PAPIER_INV:
+			if (str_[32] == ' ') {
+				str_[32] = '\0';
+				*txt_anz = 2;
+			}
+			break;
+		default:
+			break;
 		}
 	}
 




More information about the Scummvm-git-logs mailing list