diff --git a/src/save.c b/src/save.c index a88066b0..deabdecd 100644 --- a/src/save.c +++ b/src/save.c @@ -2330,8 +2330,11 @@ int save_schematic(const char *schname) /* 20171020 added return value */ xRect *rect; int rects; - if( strcmp(schname,"") ) my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname); - else return 0; + if( strcmp(schname,"")) { + if(!xctx->sch[xctx->currsch] || strcmp(schname, xctx->sch[xctx->currsch])) { + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname); + } + } else return 0; dbg(1, "save_schematic(): currsch=%d name=%s\n",xctx->currsch, schname); dbg(1, "save_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch]); /* dbg(1, "save_schematic(): abs_sym_path=%s\n", abs_sym_path(xctx->sch[xctx->currsch], "")); */