The function "sd_ble_gap_device_name_get()" returns the part of advertising name or doesn't return the name at all.

Hi, everyone, I develop the project on N52832 chip when the chip "plays" central and peripheral roles together. During the running the program I need to check the advertising name by the function "sd_ble_gap_device_name_get()". But somtimes this function returns me a part of name or doesn't return the name at all. When I check the name currently advertised the name is correct. This hapens even when the advertising name was set byt the function "sd_ble_gap_device_name_set()" What can be the reson?