TypeError: Cannot read properties of undefined (reading 'localeCompare')

Fragen und Diskussion zum Remote-Zugriff auf efa über das Intra- oder Internet

Moderator: nick

Forumsregeln
Verfasse bitte die Beiträge in den passenden Kategorien und gib ihnen einen aussagekräftigen Betreff.
Antworte bitte nur zum Thema und beginne ein neues Thema, falls Du noch etwas Zusätzliches sagen möchtest.
Antworten
arv
Beiträge: 1
Registriert: Sa 22. Feb 2025, 22:09

TypeError: Cannot read properties of undefined (reading 'localeCompare')

Beitrag von arv » Sa 29. Mär 2025, 15:15

Beim Aufruf von efaWeb kommt es nach dem erfolgreichen Login zu folgender Meldung:

Code: Alles auswählen

Huch, da ist die Anwendung leider abgestürzt.
TypeError: Cannot read properties of undefined (reading 'localeCompare')

Wenn sich das wiederholen lässt, kannst Du der Entwicklung helfen mit einem Hinweis auf den Fehler.

Aufrufhistorie
TypeError: Cannot read properties of undefined (reading 'localeCompare')
at Object.getSeatTypeText (https://arv-efa.de/js_23/oBoat.js:163:33)
at https://arv-efa.de/js_23/bPanel.js:167:29
at Array.forEach ()
at Object.listAvailableBoats (https://arv-efa.de/js_23/bPanel.js:166:15)
at Object.update (https://arv-efa.de/js_23/bPanel.js:292:35)
at Object._refreshList (https://arv-efa.de/js_23/cLists.js:548:12)
at Object.updateList (https://arv-efa.de/js_23/cLists.js:311:9)
at Object.list_resp (https://arv-efa.de/js_23/cTxHandler.js:119:10)
at Object.handleResponse (https://arv-efa.de/js_23/cTxQueue.js:488:26)
at postRequest.onload (https://arv-efa.de/js_23/cTxQueue.js:351:14)
efaCloud Version: 2.4.0_09

Fix
Zeilen 163 und 182 erweitert um "bTypeCoxed !== undefined && "

Code: Alles auswählen

	/**
	 * Get the correct seat type text description
	 */
	getSeatTypeText : function(boatRecord, boatVariantIndex) {
		var bTypeSeats = boatRecord["TypeSeats"].split(/;/g);
		var bTypeCoxed = boatRecord["TypeCoxing"].split(/;/g);
		var seatTypeText = "";

		for (var i = 0; i < bTypeSeats.length; i++) {
			var withCox = (bTypeCoxed[i] !== undefined && bTypeCoxed[i].localeCompare("COXED") == 0) ? " mit"
					: "";
			if ($_efaTypes && $_efaTypes["NUMSEATS"]
					&& $_efaTypes["NUMSEATS"][bTypeSeats[i]])
				seatTypeText += $_efaTypes["NUMSEATS"][bTypeSeats[i]] + withCox
						+ ", ";
		}
		seatTypeText = seatTypeText.substring(0, seatTypeText.length - 2);
		return seatTypeText;
	},

	/**
	 * Get the correct seat type text description
	 */
	getSeatTypeShort : function(boatRecord, boatVariantIndex) {
		var bTypeSeats = boatRecord["TypeSeats"].split(/;/g);
		var bTypeCoxed = boatRecord["TypeCoxing"].split(/;/g);
		var seatTypeShort = "";
		for (var i = 0; i < bTypeSeats.length; i++) {
			seatTypeShort += bTypeSeats[i] + ((bTypeCoxed[i] !== undefined && bTypeCoxed[i].localeCompare("COXED") == 0) ? "m"
					: "") + ",";
		}
		seatTypeShort = seatTypeShort.substring(0, seatTypeShort.length - 1);
		return seatTypeShort;
	},

Antworten