sanitize Entity inspector key/value input
This commit is contained in:
parent
2ed868d254
commit
0ac6b342d8
|
|
@ -1048,11 +1048,18 @@ void EntityInspector_applyKeyValue(){
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// RR2DO2: we don't want spaces in entity keys
|
// RR2DO2: we don't want spaces and special symbols in entity keys
|
||||||
if ( strstr( key.constData(), " " ) ) {
|
if ( std::any_of( key.cbegin(), key.cend(), []( const char c ){ return strchr( " \n\r\t\v\"", c ) != nullptr; } ) ) {
|
||||||
qt_MessageBox( g_entityKeyEntry->window(), "No spaces are allowed in entity key names." );
|
qt_MessageBox( g_entityKeyEntry->window(), "No spaces, newlines, tabs, quotes are allowed in entity key names." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ( std::any_of( value.cbegin(), value.cend(), []( const char c ){ return strchr( "\n\r\"", c ) != nullptr; } ) ) {
|
||||||
|
qt_MessageBox( g_entityKeyEntry->window(), "No newlines & quotes are allowed in entity key values." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// avoid empty key name; empty value is okay: deletes key
|
||||||
|
if( key.isEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( string_equal( key.constData(), "classname" ) ) {
|
if ( string_equal( key.constData(), "classname" ) ) {
|
||||||
Scene_EntitySetClassname_Selected( value.constData() );
|
Scene_EntitySetClassname_Selected( value.constData() );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user