oh-icon: Verify icon property is a string before performing string operations (#1412)

Fixes #1411.

Signed-off-by: H. William Welliver III <william@welliver.org>
pull/1348/head
Bill Welliver 2022-06-18 05:12:30 -04:00 committed by GitHub
parent 62855efd04
commit c7ba3effeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -48,12 +48,14 @@ export default {
iconType () {
const icon = (this.context) ? this.config.icon : this.icon
if (!icon) return 'oh'
if (!(typeof icon === 'string' || icon instanceof String)) return 'oh'
if (icon.indexOf('f7') === 0 || icon.indexOf('material') === 0) return 'f7'
if (icon.indexOf('if') === 0 || icon.indexOf('iconify') === 0) return 'iconify'
return 'oh'
},
iconName () {
const icon = (this.context) ? this.config.icon : this.icon
if (!(typeof icon === 'string' || icon instanceof String)) return ''
if (icon.indexOf(':') >= 0) return icon.substring(icon.indexOf(':') + 1)
return icon
},