Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
Signed-off-by: Bensuperpc <[email protected]>
  • Loading branch information
bensuperpc committed Dec 24, 2024
1 parent bbc6c1a commit ca99702
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/gta_cheat_finder/cuda/wrapper.cu
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ __host__ uint32_t my::cuda::jamcrc(const void* data, const uint64_t length, cons
int device = 0;
cudaGetDevice(&device);

if (device <= 0) {
std::cout << "Error: No cuda device found" << std::endl;
return 0;
}

if (length == 0 || data == nullptr) {
std::cout << "Error: Length is 0 or data is nullptr" << std::endl;
return 0;
}

cudaStream_t stream;
cudaStreamCreateWithFlags(&stream, cudaStreamNonBlocking);

Expand Down Expand Up @@ -80,6 +90,11 @@ __host__ void my::cuda::launchKernel(std::vector<uint32_t>& jamcrc_results,
int device = 0;
cudaGetDevice(&device);

if (device <= 0) {
std::cout << "Error: No cuda device found" << std::endl;
return;
}

cudaStream_t stream;
cudaStreamCreateWithFlags(&stream, cudaStreamNonBlocking);

Expand Down

0 comments on commit ca99702

Please sign in to comment.