Skip to content

Commit

Permalink
fix issue with invalid state objects (#2117)
Browse files Browse the repository at this point in the history
- closes #2115
  • Loading branch information
foxriver76 authored Sep 18, 2023
1 parent 132bfef commit a92ee75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ The icons may not be reused in other projects without the proper flaticon licens
<!--
### **WORK IN PROGRESS**
-->
## Changelog

### **WORK IN PROGRESS**
* (foxriver76) harmonized data on csv export with actual data shown by admin
* (foxriver76) on expert mode installation tab, on no selection deactivate install button
* (foxriver76) on npm install, ensure the latest version is installed
* (foxriver76) optimized enum objects
* (foxriver76) disallow Google Translate as the plugin causes crash cases
* (foxriver76) fixed crash on intro tab on docker hosts
* (foxriver76) fixed crash case on invalid state objects

## Changelog
### 6.10.1 (2023-09-11)
* (foxriver76) fixed `between` function for showing news
* (foxriver76) if date string is not parseable show the original string instead of `Invalid Date`
Expand Down
11 changes: 8 additions & 3 deletions src/src/components/ObjectBrowser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ function buildTree(objects, options) {
const _croot = {
data: {
name: parts[parts.length - 1],
title: getName(obj && obj.common && obj.common.name, options.lang),
title: getName(obj?.common?.name, options.lang),
obj,
parent: croot,
icon: getSelectIdIcon(objects, id, imagePrefix) || getSystemIcon(objects, id, 0, imagePrefix),
Expand Down Expand Up @@ -1495,6 +1495,11 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
funcs = funcs || [];
for (let i = 0; i < data.funcEnums.length; i++) {
const common = data.objects[data.funcEnums[i]]?.common;

if (!common) {
continue;
}

const name = getName(common.name, lang);
if (common?.members?.includes(id) && !funcs.includes(name)) {
if (!withParentInfo) {
Expand Down Expand Up @@ -3248,7 +3253,7 @@ class ObjectBrowser extends Component {
getFilterSelectFunction() {
const func = this.info.funcEnums.map(id => ({
name: getName(
(this.objects[id] && this.objects[id].common && this.objects[id].common.name) || id.split('.').pop(),
this.objects[id]?.common?.name || id.split('.').pop(),
),
value: id,
icon: <Icon src={this.objects[id]?.common?.icon || ''} className={this.props.classes.selectIcon} />,
Expand Down Expand Up @@ -4588,7 +4593,7 @@ class ObjectBrowser extends Component {
const enums = (type === 'room' ? this.info.roomEnums : this.info.funcEnums)
.map(id => ({
name: getName(
(this.objects[id] && this.objects[id].common && this.objects[id].common.name) ||
this.objects[id]?.common?.name ||
id.split('.').pop(),
this.props.lang,
),
Expand Down

0 comments on commit a92ee75

Please sign in to comment.