* fix crash, if renaming tag w/o shaders assigned
This commit is contained in:
parent
98937beb75
commit
78db33ff4a
|
|
@ -383,15 +383,16 @@ int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){
|
|||
return 0;
|
||||
}
|
||||
xmlNodeSetPtr nodePtr = result->nodesetval;
|
||||
if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) {
|
||||
for ( int i = 0; i < nodePtr->nodeNr; i++ )
|
||||
{
|
||||
xmlNodePtr ptrContent = nodePtr->nodeTab[i];
|
||||
char* content = (char*)xmlNodeGetContent( ptrContent );
|
||||
|
||||
for ( int i = 0; i < nodePtr->nodeNr; i++ )
|
||||
{
|
||||
xmlNodePtr ptrContent = nodePtr->nodeTab[i];
|
||||
char* content = (char*)xmlNodeGetContent( ptrContent );
|
||||
|
||||
if ( strcmp( content, oldtag ) == 0 ) { // found a node with old content?
|
||||
xmlNodeSetContent( ptrContent, (const xmlChar*)newtag.c_str() );
|
||||
num++;
|
||||
if ( strcmp( content, oldtag ) == 0 ) { // found a node with old content?
|
||||
xmlNodeSetContent( ptrContent, (const xmlChar*)newtag.c_str() );
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -500,7 +501,7 @@ void XmlTagBuilder::GetShaderTags( const char* shader, std::vector<CopiedString>
|
|||
if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) {
|
||||
for ( int i = 0; i < nodePtr->nodeNr; i++ )
|
||||
{
|
||||
tags.push_back( (CopiedString)(char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) );
|
||||
tags.push_back( CopiedString( (char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ) );
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject( xpathPtr );
|
||||
|
|
@ -556,7 +557,7 @@ void XmlTagBuilder::GetAllTags( std::set<CopiedString>& tags ){
|
|||
if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) {
|
||||
for ( int i = 0; i < nodePtr->nodeNr; i++ )
|
||||
{
|
||||
tags.insert( (CopiedString)(char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) );
|
||||
tags.insert( CopiedString( (char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -587,7 +588,7 @@ void XmlTagBuilder::TagSearch( const char* expression, std::set<CopiedString>& p
|
|||
{
|
||||
ptr = nodePtr->nodeTab[i];
|
||||
xmlattrib = xmlGetProp( ptr, (const xmlChar*)"path" );
|
||||
paths.insert( (CopiedString)(char*)xmlattrib );
|
||||
paths.insert( CopiedString( (char*)xmlattrib ) );
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject( xpathPtr );
|
||||
|
|
|
|||
|
|
@ -2553,7 +2553,7 @@ void TextureBrowser_renameTag(){
|
|||
|
||||
TagBuilder.RenameShaderTag( oldTag, newTag.c_str() );
|
||||
|
||||
g_TextureBrowser.m_all_tags.erase( (CopiedString)oldTag );
|
||||
g_TextureBrowser.m_all_tags.erase( CopiedString( oldTag ) );
|
||||
g_TextureBrowser.m_all_tags.insert( newTag );
|
||||
|
||||
BuildStoreAssignedTags( g_TextureBrowser.m_assigned_store, g_TextureBrowser.shader.c_str(), &g_TextureBrowser );
|
||||
|
|
@ -2595,7 +2595,7 @@ void TextureBrowser_deleteTag(){
|
|||
}
|
||||
|
||||
TagBuilder.DeleteTag( tagSelected );
|
||||
g_TextureBrowser.m_all_tags.erase( (CopiedString)tagSelected );
|
||||
g_TextureBrowser.m_all_tags.erase( CopiedString( tagSelected ) );
|
||||
|
||||
BuildStoreAssignedTags( g_TextureBrowser.m_assigned_store, g_TextureBrowser.shader.c_str(), &g_TextureBrowser );
|
||||
BuildStoreAvailableTags( g_TextureBrowser.m_available_store, g_TextureBrowser.m_assigned_store, g_TextureBrowser.m_all_tags, &g_TextureBrowser );
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user