When there are multiple empty layers needs to be replaced, error_msg is
assigned multiple times simutaneously by tbb, which causes problem.
Jira: STUDIO-3320
Change-Id: I52a48c9fe284d15aeb8e4e9e5d1db7e0c3321ad6
(cherry picked from commit fba54c063637a1bab4d835e2e5f8558b2affa4e6)