Strange kernel execution

I am writing a kernel that should generate lines for a bitmap.
The code is working but I get some strange pixels in the result that shouldn’t be there.
I came to the conclusion that certain pixel locations are perhaps rendered multiple times. To check if this is true I added a zero-filled array in which the pixel-index that is calculated is set to 1. When the kernel detects that the pixel-index is already filled it should skip the pixel (jump out of the kernel)
However, after adding this code I get a blank bitmap.

This is the part of the code:

__global__ void getPixels(unsigned char line[], unsigned char done[]) {
    int lineidx = blockIdx.x * blockDim.x + threadIdx.x;		

    __syncthreads();
    if (done[lineidx] == 0) {     // the pixel is not set
	    done[lineidx] = 1;      // indicate that the pixel is set

        line[lineidx] = 123;  // only an example value
     }
 }

the global function is called in the usual way.

What am I doing wrong?