Questions tagged [null-pointer]

In computing, a null pointer has a value reserved for indicating that the pointer does not refer to a valid object.

In computing, a null pointer has a value reserved for indicating that the pointer does not refer to a valid object.

Use this tag for programming questions that refers to a problems having null-pointer exception, bad memory access etc.

Resources:

365 questions
-1
votes
5 answers

Value of pointer to stack integer (becomes NULL)?

Given the following code snippet: #include using namespace std; int *pPointer; int func() { int num; num = 25; pPointer = # } int main() { func(); cout << *pPointer << endl; cout << *pPointer << endl; …
gcraig
  • 103
  • 8
-1
votes
2 answers

null pointer exception android when starting the activity

Hi I am create some imagebuttons and then adding some on click listeners but I am getting this null pointer exception error. I have included the logcat as well if that is more helpful.Any advice guys ? Many thanks! import android.app.Activity; …
Nikolas
  • 51
  • 1
  • 2
  • 8
-1
votes
1 answer

Java assignment :Forloop wont fall back into my while loop and is giving a null pointer error

In this snippet for my assignment i have two arrays of type member and account. They are tied together by ssn that is given by both in member and member account creation. My problem is that after the arrays are searched through i get an error…
jlewis.is
  • 1
  • 3
-2
votes
1 answer

Dereferencing null pointer warning and code run stuck infinitely

So i am trying to solve a problem to reverse a linked list and following is what i came up with. class Solution { public: /* void insertList(struct Node* head, int data) { Node* temp{ head }; while (temp->next != nullptr) …
-2
votes
1 answer

Java filter NullPointer

Trying to create filter, need to choose records which type is not equals "N". I trying do it by this way, but I getting NullPointer. I think this is because in my database Type sometimes is null. How can I fix this filter to not get…
Deividas.r
  • 17
  • 1
-2
votes
2 answers

segmentation fault (c language)

While trying to recover jpgs from a raw file in week4 of CS50 course , I got this seg fault error which I can't understand why or how it is caused, all I can tell is that according to valgrind line 110 causes this issue I am fairly new to c…
m3sfit
  • 65
  • 6
-2
votes
1 answer

panic: runtime error: invalid memory address or nil pointer dereference (time and again)

I am very new to golang and for the most part have no idea what im doing so far. I tried to run a simple find() query to get all documents from my databse and I cant seem to get it to work i keep getting this error panic: runtime error: invalid…
RashadArbab
  • 85
  • 1
  • 1
  • 9
-2
votes
1 answer

Why have null pointers when I am not ready to declare the appropriate value?

I am learning to code in C++ and came across null ptr. The book i read says that null pointers can not be dereferenced. That makes sense because there is nothing to dereference. But my question is that if null pointers can not be dereferenced then…
Es Kay
  • 1
-2
votes
2 answers

cppcheck null pointer dereference, but it can actually become null

I have a function that can return a pointer to a structure or NULL (Example to explain return possibilities of get_my_struct_from_[X] functions): struct my_struct *my_function(my_struct i) { if (i.value < 5) return i; else return NULL; } In…
Czoka
  • 118
  • 3
  • 12
-2
votes
1 answer

Trouble parsing a json in android studio that works in one activity and not the other

I have this Json which I parse on the first activity of my app but when i try to recreate the same thing with the same json on the other activity, it just wont work. I've been reading about this and about nullpointers to see if I can see where can…
Manuel Cruz
  • 53
  • 1
  • 1
  • 8
-2
votes
1 answer

C++ - Check whether pointer in pointer array is already "filled"

I am working on a project for my University where i have to implement a Hash table. I am quite new to c++, so please forgive me if I am not specific enough or if I have completely wrong assumptions. Soo..my main problem is that I have a so called…
-2
votes
2 answers

Debugger Throwing nullptr Exception During nullptr Check

While going through runtime, I'm getting a nullptr exception while this code is executing. bool Tree::Insert(int n) { if (root == nullptr) // This is where it throws { Node* root = new Node(n); return true; …
-2
votes
2 answers

java.lang.nullpointer error in linkedlist in android

I am trying to make a student registration interface with several classes, provided in the requirement. In doing so, the linkedlist in my CourseFactory class is showing a null pointer. public class Course { private String id; private String…
-2
votes
1 answer

OpenCV C++ program using C API cvClearMemStorage null pointer error

I'm getting started with OpenCV and it's C API, I've written this face detection program but it cannot be executed, I'm using OpenCV 2.4.9, here's my code: #include "opencv/cv.h" #include "opencv/highgui.h" #include #include…
Cro
  • 338
  • 4
  • 18
-2
votes
2 answers

NullPointerException when i use my custom view

Hello ive created a custom view who extends relativeLayout. an i want to make it customizable. public class Niveauview extends RelativeLayout { public TextView musiqueView = new TextView(getContext()), artisteView = new…